sql - MS Access Query - Display Exclusive Records -
i have built query lists top 100 skus sold in company year. sell on 650 items, multiple variations on size of item ranges out around 15,000 total sku's trying write query show orders made exclusively of top 100 sku's able orders contain sku in top 100.
here @ sql statement
select year([date_fld]) expr1, tbl_salesorderdetail.item_code, tbl_salesorderdetail.cust_code, tbl_salesorderdetail.doc_no (tbl_salesorderdetail left join qry_nottop100 on tbl_salesorderdetail.item_code = qry_nottop100.code) inner join qry_top100 on tbl_salesorderdetail.item_code = qry_top100.code (((year([date_fld]))=year(date())) , ((qry_nottop100.code) null)) order tbl_salesorderdetail.doc_no;
any ideas on doing wrong?
what want anti-join. there multiple ways that, not in
1 of ways. not in
isn't efficient, idea on improve upon things.
- remove
left join
qry_nottop100
. - remove
where
clause onqry_nottop100
- add
where
clauseand tbl_salesorderdetail.item_code not in ( select qry_nottop100.code qry_nottop100 )
Comments
Post a Comment