Help with subquery

mardi 24 mars 2015

Can someone help me create a subquery? What is going one here is I have the first query that constrains the results to only those in the Item Master TBL with no GEMMS code The 2nd query limits those results to those that are not in the Excluded TBL. No matter what I try - no joy. And equally important, I need to have an updatable query when done. Will making this a subquery allow it to be updated? Thanks in advance for any assistance!



Sue



Main Query code:


Quote:








SELECT [Item Master TBL].[GEMMS Code], [37a].ITEM_NO, [37a].TYPE, [37a].PACK_, [37a].ITEM_DESC1, [37a].UPC_NO, [37a].BRAND, [37a].ALT_ITEMA, [37a].COST, [37a].[CASE Pack GTIN], [37a].INCLUDE, [37a].Excluded

FROM [Item Master TBL] RIGHT JOIN 37a ON [Item Master TBL].[GEMMS Code] = [37a].ITEM_NO

WHERE ((([Item Master TBL].[GEMMS Code]) Is Null) AND (([37a].TYPE)="FG") AND (([37a].PACK_)="03" Or ([37a].PACK_)="05"))

ORDER BY [37a].ITEM_DESC1;



The Sub Query code:


Quote:








SELECT [Item QRY].[GEMMS Code], [Item QRY].ITEM_NO, [Item QRY].TYPE, [Item QRY].PACK_, [Item QRY].ITEM_DESC1, [Item QRY].UPC_NO, [Item QRY].BRAND, [Item QRY].ALT_ITEMA, [Item QRY].COST, [Item QRY].[CASE Pack GTIN], [Item QRY].INCLUDE, [Item QRY].Excluded

FROM [Item QRY] LEFT JOIN [Excluded TBL] ON [Item QRY].[ITEM_NO] = [Excluded TBL].[ITEM_NO]

WHERE ((([Excluded TBL].ITEM_NO) Is Null))

ORDER BY [Item QRY].ITEM_DESC1;




Help with subquery

0 commentaires:

Enregistrer un commentaire

Labels