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 |
kavithak.official
Starting Member
7 Posts |
Posted - 2010-11-26 : 00:54:54
|
I have a table T that has few columns.I am interested in count of distinct of (col1 and col2)Note : col1 is of binary datatype where as col2 is of datetime datatype.This does not just happen if you use (count(distinct col1, col2))>0 doesn work(count(distinct col1+col2))>0 doesn workI want to find out the count when it is greater than 0.Please provide your inputs on this issue.thanks and regards,Kavitha K |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-11-26 : 09:35:02
|
select col1,col2,count(*) from tablegroup by col1,col2MadhivananFailing to plan is Planning to fail |
 |
|
nigelrivett
Master Smack Fu Yak Hacker
3385 Posts |
Posted - 2010-11-26 : 09:38:48
|
Not clear what you want - madhivanan's query gives the number of rows for each col1, col2This give the number of distinct col1,col2 entriesselect count(*)from(select distint col1, col2 fro tbl) a==========================================Cursors are useful if you don't know sql.SSIS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
|
|