I am looking for an optimized query that shows all records from Items table MINUS those that are already in Order Detail.
PARAMETERS [BILL Number] Text ( 255 );
SELECT QRY.ItemID_PK, QRY.Qty
FROM (SELECT ItemID_PK, 0 as Qty FROM tblItems
where ItemID_PK NOT in (select ItemID_FK from tblSalesDetail where SalesID_FK= [BILL Number])
union
SELECT tblSalesDetail.ItemID_FK,Quantity
FROM tblSalesDetail
WHERE (((tblSalesDetail.SalesID_FK)= [BILL Number]))
) AS QRY;
Best,
Ozair
_._,_._,_
Groups.io Links:
You receive all messages sent to this group.
View/Reply Online (#115955) | Reply To Group | Reply To Sender | Mute This Topic | New Topic
Your Subscription | Contact Group Owner | Unsubscribe [sugeng.panjalu.access@blogger.com]
_._,_._,_
Tidak ada komentar:
Posting Komentar