Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
kohlhaas77
Starting Member
25 Posts |
Posted - 2009-07-08 : 13:20:48
|
| Iyou need to get a count of distinct rows by say, 4 variables, how would you do that? I have "SELECT COUNT(DISTINCT AMISYS__ID, TIN, EFF_DT, CAN_DT) FROM NHP_Facets_Phase_1_PhyCount", but I get an error on the commasDan Kohlhaas |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-07-08 : 13:28:16
|
do you mean this?SELECT COUNT(1) FROM (SELECT AMISYS__ID, TIN, EFF_DT, CAN_DT FROM NHP_Facets_Phase_1_PhyCount GROUP BY AMISYS__ID, TIN, EFF_DT, CAN_DT)t |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-07-08 : 13:29:07
|
or this?SELECT AMISYS__ID, TIN, EFF_DT, CAN_DT , COUNT(PKCol)FROM NHP_Facets_Phase_1_PhyCount GROUP BY AMISYS__ID, TIN, EFF_DT, CAN_DT where PKCol is your primary key column |
 |
|
|
Lamprey
Master Smack Fu Yak Hacker
4614 Posts |
Posted - 2009-07-08 : 13:30:28
|
| SELECT AMISYS__ID, TIN, EFF_DT, CAN_DT, COUNT(*)FROM FROM NHP_Facets_Phase_1_PhyCountGROUP BY AMISYS__ID, TIN, EFF_DT, CAN_DTEDIT: dang too slow.. :) |
 |
|
|
|
|
|
|
|