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 |
|
banan
Starting Member
2 Posts |
Posted - 2004-12-23 : 03:50:14
|
| Hi people!I'm trying to get an overview over how many orders we get during an hour, but I'm having serious trouble figuring out how to do this ..My table; sOrder contains amongst others, these fields;OrderId (int), OrderNo (int), OrderDateTime (datetime)Now, everytime we get an order, it adds a new record with an id, number and timestamp.How do I pull out something like the following;OrderDateTime = '23/12/2004'Hour Orders0 101 232 9.. ..21 3222 3623 23Or .. even better;Date 0 1 2 .. 21 22 2322/12/2004 21 12 5 12 15 1823/12/2004 10 23 9 32 36 23Any ideas? =) Thanks in advance!b. |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2004-12-23 : 03:52:44
|
| select convert(varchar(8),dte,112), datepart(hh,dte), count(*)from tblgroup by convert(varchar(8),dte,112), datepart(hh,dte)order by convert(varchar(8),dte,112), datepart(hh,dte)==========================================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. |
 |
|
|
banan
Starting Member
2 Posts |
Posted - 2004-12-23 : 04:13:41
|
| Sweet - thanks nr :-)Merry xmas.b. |
 |
|
|
|
|
|
|
|