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 |
|
rajani
Constraint Violating Yak Guru
367 Posts |
Posted - 2006-04-12 : 22:49:51
|
| Hi friendshow to write a sql statement tht return count unique recordsi mean if have value like below101012121my sql stmt should return 3 (i.e. two 10s + two 12s + one 1)Thanks for the help.Cheers |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2006-04-12 : 22:52:32
|
[code]select count(distinct yourcolname) from yourtable[/code] KH |
 |
|
|
rajani
Constraint Violating Yak Guru
367 Posts |
Posted - 2006-04-12 : 22:56:21
|
| oops .Thanks KH .tht worked nicely.actually i've benn tryingselect count(distinct yourcolname) from yourtable group by yourcolnamedamn!!Cheers |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-04-13 : 05:14:12
|
| If you use Group by then Distinct is not required and vice versaMadhivananFailing to plan is Planning to fail |
 |
|
|
rajani
Constraint Violating Yak Guru
367 Posts |
Posted - 2006-04-17 : 17:00:57
|
| Thanks Madhivanan.understoodCheers |
 |
|
|
|
|
|