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 |
Shivas Irons
Starting Member
1 Post |
Posted - 2002-11-11 : 17:44:01
|
I have a table with transactional data in it. Each row represents one transaction and has a field (dCreated) which identifies when it was created.With the following syntax I can count how many transactions occurred per minute:SELECT COUNT(*) AS [count], DAY(dCreated) AS d, { fn HOUR(dCreated) } AS h, { fn MINUTE(dCreated) } AS mFROM tblAuditUploadAppProfileGROUP BY DAY(dCreated), { fn HOUR(dCreated) }, { fn MINUTE(dCreated) }ORDER BY DAY(dCreated), { fn HOUR(dCreated) }, { fn MINUTE(dCreated) }But if a minute passes with no transactions it doesn't show up here. How do I 'show the zeros'?Thanks,Cam |
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2002-11-11 : 19:46:49
|
You will have to create a table with all the minutes in it and outer join from it.You can use a derived table too.Also you could put this result into a temp table then fill in the gaps with 0's.==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
|
|
|
|
|