Hussnain
03/14/2025, 11:24 PMSELECT
inventory.item_id AS inventory_item_id,
inventory.item_name AS inventory_item_name,
inventory.category_name AS inventory_category_name,
case
when (coalesce(inventory.location_name, transaction_details.location_name)) = 'Gastown' then 'GT'
when (coalesce(inventory.location_name, transaction_details.location_name)) = 'Kitsilano' then 'KT'
when (coalesce(inventory.location_name, transaction_details.location_name)) = 'West Vancouver' then 'WV'
when (coalesce(inventory.location_name, transaction_details.location_name)) = 'Queen West' then 'QW'
when (coalesce(inventory.location_name, transaction_details.location_name)) = 'Ossington' then 'OA'
when (coalesce(inventory.location_name, transaction_details.location_name)) = 'South Granville' then 'SG'
when (coalesce(inventory.location_name, transaction_details.location_name)) = 'Distribution Centre 1' then 'DC'
when (coalesce(inventory.location_name, transaction_details.location_name)) = 'Guildford' then 'GF'
when (coalesce(inventory.location_name, transaction_details.location_name)) = 'Mayfair' then 'MF'
when (coalesce(inventory.location_name, transaction_details.location_name)) = 'Chinook' then 'CC'
when (coalesce(inventory.location_name, transaction_details.location_name)) = 'Eaton Centre' then 'TC'
when (coalesce(inventory.location_name, transaction_details.location_name)) = 'Market Mall' then 'MM'
when (coalesce(inventory.location_name, transaction_details.location_name)) = 'Woodgrove' then 'WG'
when (coalesce(inventory.location_name, transaction_details.location_name)) = 'Upper Canada' then 'UC'
when (coalesce(inventory.location_name, transaction_details.location_name)) = 'Summerhill' then 'SH'
when (coalesce(inventory.location_name, transaction_details.location_name)) = 'Oakville' then 'OV'
when (coalesce(inventory.location_name, transaction_details.location_name)) = 'Pacific Centre' then 'PC'
when (coalesce(inventory.location_name, transaction_details.location_name)) = 'Victoria' then 'VC'
else 'NONE'
end
AS inventory_location_abbreviation,
inventory.capsules AS inventory_capsules,
inventory.themes AS inventory_themes,
inventory.mh3class AS inventory_mh3class,
inventory.mh1division AS inventory_mh1division,
inventory.lifestyle_category AS inventory_lifestyle_category,
inventory.item_size AS inventory_item_size,
inventory.base_price AS inventory_base_price,
inventory.original_price AS inventory_original_price,
transaction_details.transaction_number AS transaction_details_transaction_number,
(DATE(transaction_details.transaction_date)) AS transaction_details_transaction_date,
COALESCE(SUM(CASE WHEN transaction_details.is_sales_transaction AND (transaction_details.account_name = 'Sales') AND ((transaction_details.transaction_status NOT IN ('Voided', 'Unapproved Payment') OR transaction_details.transaction_status IS NULL)) THEN transaction_details.item_count ELSE NULL END), 0) AS transaction_details_qty_net,
COALESCE(SUM(CASE WHEN transaction_details.is_sales_transaction AND ((transaction_details.account_name IN ('Sales', 'Consignment Sales'))) AND ((transaction_details.transaction_status NOT IN ('Voided', 'Unapproved Payment') OR transaction_details.transaction_status IS NULL)) THEN ( transaction_details.transaction_amount + coalesce(transaction_details.discount_amount,0) ) ELSE NULL END), 0) AS transaction_details_sum_transaction_amount_w_discount
FROM `tls-prod-data-lake.looker_pdt.LR_BX1NF1741993277677_inventory` AS inventory
LEFT JOIN `tls-prod-data-lake.looker_pdt.LR_BXW9O1741993314456_transaction_details` AS transaction_details ON inventory.item_id = transaction_details.item_id
AND (inventory.location_id = transaction_details.location_id OR inventory.location_id IS NULL)
AND 1=1 -- no filter on 'transaction_details.transaction_date_filter'
AND not transaction_details.is_journal_entry
WHERE (inventory.item_id ) = 78763 AND (coalesce(inventory.location_name, transaction_details.location_name)) = 'Chinook' AND (CASE
WHEN transaction_details.location_id = 3 THEN 'GT'
WHEN transaction_details.location_id = 4 THEN 'KT'
WHEN transaction_details.location_id = 5 THEN 'WV'
WHEN transaction_details.location_id = 8 THEN 'QW'
WHEN transaction_details.location_id = 6 THEN 'OA'
WHEN transaction_details.location_id = 7 THEN 'SG'
WHEN transaction_details.location_id = 2 THEN 'DC'
WHEN transaction_details.location_id = 21 THEN 'GF'
WHEN transaction_details.location_id = 30 THEN 'MF'
WHEN transaction_details.location_id = 31 THEN 'CC'
WHEN transaction_details.location_id = 32 THEN 'TC'
WHEN transaction_details.location_id = 36 THEN 'MM'
WHEN transaction_details.location_id = 39 THEN 'WG'
WHEN transaction_details.location_id = 45 THEN 'SH'
WHEN transaction_details.location_id = 40 THEN 'UC'
WHEN transaction_details.location_id = 63 THEN 'OV'
WHEN transaction_details.location_id = 70 THEN 'PC'
WHEN transaction_details.location_id = 73 THEN 'VC'
WHEN transaction_details.location_id IS NULL THEN 'NONE'
END) IN ('CC', 'DC', 'GF', 'GT', 'KT', 'MF', 'MM', 'NONE', 'OA', 'OV', 'PC', 'QW', 'SG', 'SH', 'TC', 'UC', 'VC', 'WG', 'WV') AND (case
when (coalesce(inventory.location_name, transaction_details.location_name)) = 'Gastown' then 'GT'
when (coalesce(inventory.location_name, transaction_details.location_name)) = 'Kitsilano' then 'KT'
when (coalesce(inventory.location_name, transaction_details.location_name)) = 'West Vancouver' then 'WV'
when (coalesce(inventory.location_name, transaction_details.location_name)) = 'Queen West' then 'QW'
when (coalesce(inventory.location_name, transaction_details.location_name)) = 'Ossington' then 'OA'
when (coalesce(inventory.location_name, transaction_details.location_name)) = 'South Granville' then 'SG'
when (coalesce(inventory.location_name, transaction_details.location_name)) = 'Distribution Centre 1' then 'DC'
when (coalesce(inventory.location_name, transaction_details.location_name)) = 'Guildford' then 'GF'
when (coalesce(inventory.location_name, transaction_details.location_name)) = 'Mayfair' then 'MF'
when (coalesce(inventory.location_name, transaction_details.location_name)) = 'Chinook' then 'CC'
when (coalesce(inventory.location_name, transaction_details.location_name)) = 'Eaton Centre' then 'TC'
when (coalesce(inventory.location_name, transaction_details.location_name)) = 'Market Mall' then 'MM'
when (coalesce(inventory.location_name, transaction_details.location_name)) = 'Woodgrove' then 'WG'
when (coalesce(inventory.location_name, transaction_details.location_name)) = 'Upper Canada' then 'UC'
when (coalesce(inventory.location_name, transaction_details.location_name)) = 'Summerhill' then 'SH'
when (coalesce(inventory.location_name, transaction_details.location_name)) = 'Oakville' then 'OV'
when (coalesce(inventory.location_name, transaction_details.location_name)) = 'Pacific Centre' then 'PC'
when (coalesce(inventory.location_name, transaction_details.location_name)) = 'Victoria' then 'VC'
else 'NONE'
end
) IN ('CC', 'DC', 'GF', 'GT', 'KT', 'MF', 'MM', 'NONE', 'OA', 'OV', 'PC', 'QW', 'SG', 'SH', 'TC', 'UC', 'VC', 'WG', 'WV')
GROUP BY
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14
ORDER BY
13 DESC
LIMIT 500
Celigo AI
03/14/2025, 11:24 PMAI generated answer (using internal Slack threads):In NetSuite, you can use SuiteQL to directly query the database tables. However, the table names are not directly exposed in the SuiteQL interface. You would need to use the Record Browser to find the internal ID of the record type you want to query, which corresponds to the table name in SuiteQL. For example, if you want to query the 'Customer' table, you would look up the 'Customer' record type in the Record Browser, and find that its internal ID is 'customer'. You would then use this internal ID in your SuiteQL query. Here is an example of how you might do this:
sql
SELECT * FROM customer
This would return all fields from the 'customer' table.
Please note that not all record types are available for querying via SuiteQL. Some record types, such as system notes or audit trail records, are not exposed in the Record Browser and cannot be queried directly.
Also, please be aware that querying large amounts of data directly from the database can have performance implications, and should be done with care.
******
Disclaimer:
This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes.
******Celigo AI
03/14/2025, 11:25 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.830936
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.813394189
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.808766246
Celigo AI
03/14/2025, 11:25 PM