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 |
|
alistair4267
Starting Member
10 Posts |
Posted - 2011-11-16 : 10:03:22
|
| Hi AllI have two databases with the following columns--Person Table--PersoniID (PK)CreateDateTimeEmailAddress--Order Table--PersonID (FK)CreateDateTimeOrderIDOrderDateTimeStatusThe problem i am having is that i need to report on how many order have come in for a specific hour for a specific company (see below, this is what i would like)CompanyName | 8AM | 9am | 10am | 11am ABC 123 10 5 6 5Big C 15 0 0 25Could some possible point me in the right direction on how i could achieve this ?Kind RegardsAlistair |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-11-16 : 10:30:01
|
| GROUP BY DATEPART(hh,datevalue) and apply pivot over it------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|