Quantcast
Channel: Questions in topic: "distinct"
Viewing all articles
Browse latest Browse all 38

sql for counting distinct values

$
0
0
I have one table with three columns : product _no , week_no , outlet_no. data looks like this 345 , 201522 , 98 567 , 201521 , 76 and so on.. I need to calc the no of outlets for each product every week. but they should be uniqe...e.g If a product was sold in outlets A and B in first week the no of stores in first week should be 2 , if it is sold in B , C , D next week the total should be 4 for 2nd week , if it is sold in A and D in third week the total should be still 4 for 3rd week. How do I do this...Any help will be greatly appreciated.

Viewing all articles
Browse latest Browse all 38

Trending Articles