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

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -