sql - Select subset from subset -
data has 1 table 2 relevant fields:
- ordernumber
- productid
how structure sql find :-
select ordernumber productid in (a,b) now, on subset, select productid in (a,b,c,d,e) show customername, ordernumber, productid, productprice
goal find orders contain 2 specific products, measure sales of 3 specific products related a,b.
i'm not sure want, take stab.
this show details of orders 1 of 5 product id's
select customername, ordernumber, productid, productprice yourtable productid in ('a','b','c','d','e')
this count orders you
select productid, count(*) count yourtable productid in ('a','b','c','d','e') group productid
Comments
Post a Comment