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 |
|
baska123
Yak Posting Veteran
64 Posts |
Posted - 2007-08-03 : 16:28:16
|
| We have a date stored as a sys date in a table. We want to count how many records are under each year. Any ideas for SQL statement.Thanks |
|
|
dinakar
Master Smack Fu Yak Hacker
2507 Posts |
Posted - 2007-08-03 : 16:39:54
|
| COUNT(*), GROUP BY YEAR(Datecolumn).Dinakar Nethi************************Life is short. Enjoy it.************************http://weblogs.sqlteam.com/dinakar/ |
 |
|
|
dinakar
Master Smack Fu Yak Hacker
2507 Posts |
Posted - 2007-08-03 : 16:40:29
|
| or COUNT(*) Between Date1 and Date2.Dinakar Nethi************************Life is short. Enjoy it.************************http://weblogs.sqlteam.com/dinakar/ |
 |
|
|
baska123
Yak Posting Veteran
64 Posts |
Posted - 2007-08-03 : 17:22:40
|
| Thanks for hints.This is what worked for meSELECT COUNT(*), date_row FROM TAXBUS.TRANS T GROUP BY to_char(T.DT) |
 |
|
|
baska123
Yak Posting Veteran
64 Posts |
Posted - 2007-08-03 : 17:27:57
|
| One correctionSELECT COUNT(*) FROM TAXBUS.TRANS T GROUP BY to_char(T.DT, 'yyyy') |
 |
|
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
Posted - 2007-08-03 : 17:49:21
|
quote: Originally posted by baska123 One correctionSELECT COUNT(*) FROM TAXBUS.TRANS T GROUP BY to_char(T.DT, 'yyyy')
That's Oracle SQL, not Microsoft SQL Server TSQL.CODO ERGO SUM |
 |
|
|
|
|
|