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

'hasOwnProperty' in javascript -

python - ValueError: No axis named 1 for object type <class 'pandas.core.series.Series'> -

java - How to provide dependency injections in Eclipse RCP 3.x? -