We are required to display UID that is in BOS_BARCODE_IT_LOG but not exists in BOS_BARCODE_DO_LOG
The reason that I joined with OITM is because the user asked for the selection Criteria in SAP Business One.
SELECT X0."DATE",X0."ITEMCODE", X0."UID"
FROM "BOS_BARCODE_IT_LOG" X0 JOIN OITM X1 ON
X0."ITEMCODE" = X1."ItemCode"
WHERE
X1."ItemCode" = '[%0]'
AND NOT EXISTS (
SELECT X2."UID" FROM "BOS_BARCODE_DO_LOG" X2
WHERE X0."ITEMCODE" = X2."ITEMCODE" AND
X0."UID" = X2."UID" AND
X0."DATE" = X2."DATE"
)
We need that '[%0]' in order to display
The problem is that, when I tried to search any items there, the query returns no result.
What I've tried.
I Select only from one table without OITM, and neverthless, did not provide Query Selection Criteria.
I Tried this as well
SELECT X0."DATE",X0."ITEMCODE", X0."UID"
FROM "BOS_BARCODE_IT_LOG" X0
WHERE
X0."ITEMCODE" = '[%0]' AND
NOT EXISTS (
SELECT X1."UID" FROM "BOS_BARCODE_DO_LOG" X1
WHERE X0."ITEMCODE" = X1."ITEMCODE" AND
X0."UID" = X1."UID" AND
X0."DATE" = X1."DATE"
)
And it provide error.
1). [SAP AG][LIBODBCHDB DLL][HDBODBC] Syntax error or access violation;257 sql syntax error: incorrect syntax near ")": line 14 col 1 'Received Alerts' (OAIB) (at pos 299)
Another thing, is it possible to use subquery with more than one tables and provide the expected result (Not just blank result)
What I learned in the tutorial that subquery only used for one table. This is one of the examples.
https://www.tutorialspoint.com/sql/sql-sub-queries.htm
Thanks.
