Senin, 05 April 2021

[MSAccessProfessionals] Querying from Items and Order Detail

Hi,

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;
 
Currently I use, but I prefer NOT use it with Parameters ( Display all Bill Numbers without user's intervention ).

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