How to query only the item lines in suiteql transa...
# ask-stanley-ai
t
How to query only the item lines in suiteql transactionline
c
AI generated answer (using internal Slack threads):
To query only the item lines in SuiteQL transactionline, you can use the
TransactionLine
table and join it with the
transaction
table. Here is an example of how you can do this:
Copy code
sql
SELECT transaction.id, transaction.terms, transaction.type, transaction.tranid, transaction.trandisplayname, TransactionLine.item, item.fullname 
FROM transaction 
INNER JOIN TransactionLine ON ( Transaction.ID = TransactionLine.Transaction ) 
LEFT JOIN item ON (TransactionLine.item = item.id ) 
WHERE transaction.type='CustInvc' AND TransactionLine.itemtype IS NOT NULL 
AND transactionline.itemtype<>'TaxGroup' 
AND transactionline.itemtype<>'TaxItem' 
AND transactionline.itemtype<>'NonInvtPart'
This query will return the transaction details along with the item details from the
TransactionLine
table. The
TransactionLine.itemtype
is used to filter out non-item lines. Please note that this query will return multiple rows for a single invoice if it has multiple item lines. If you want to get a single row per invoice, you will need to use aggregate functions or subqueries, which are not fully supported in SuiteQL. ****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.839321554
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.818387866
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.814951181
Please provide your feedback on this answer.