Can someone help me with the following query please?
Sample data
product date cat1 cat2 cat3 cat4 cat5
============================
00001 1/1/05 T F T T T
00001 1/1/05 T F F F T
00001 2/1/05 F T T T T
00001 2/1/05 T T F F F
00001 2/1/05 F T F F T
I want different counts of each category for a selected product. If there are more than one "T" listed in a category for the same day, I want to count that as 1.
ie. the requered results set as follows
productid cat1_count cat2_count cat3_count cat4_count cat5_count
============================================
00001 2 1 2 2 2
As you can see cat1_Count return 2 (1 for 1/1/05 and 1 for 2/1/05 though there are 2 records with "T" on 1/1/05)
Thanks in advance
Sample data
product date cat1 cat2 cat3 cat4 cat5
============================
00001 1/1/05 T F T T T
00001 1/1/05 T F F F T
00001 2/1/05 F T T T T
00001 2/1/05 T T F F F
00001 2/1/05 F T F F T
I want different counts of each category for a selected product. If there are more than one "T" listed in a category for the same day, I want to count that as 1.
ie. the requered results set as follows
productid cat1_count cat2_count cat3_count cat4_count cat5_count
============================================
00001 2 1 2 2 2
As you can see cat1_Count return 2 (1 for 1/1/05 and 1 for 2/1/05 though there are 2 records with "T" on 1/1/05)
Thanks in advance