OK I’m using MS SQL and I have a table with values like this:
ID Date Radio Time 111 4/1/09 1 3:00:00 111 4/1/09 2 4:00:00 111 4/1/09 3 14:00:00 111 4/1/09 1 15:00:00 111 4/1/09 3 16:00:00 222 4/1/09 2 2:00:00 222 4/1/09 1 5:00:00 222 4/1/09 1 19:00:00 333 4/1/09 1 3:00:00 333 4/1/09 2 5:00:00 333 4/1/09 2 13:00:00 333 4/1/09 3 17:00:00
Ok so I need a Query where:
window 1 < 12:00 13 < window 2 < 15:00 window 3 > 16:00
To return sums:
Window1 Window2 Window3 Radio 1: 3 0 2 Radio 2: 3 1 0 Radio 3: 0 1 2
I have tried using count() but I cannot get these to join correctly on the right ‘radio’ Any suggestions?
Adjust <= / < and >= / > as appropriate; you weren’t very specific on that point.
Also, your first condition was
window 1 > 12. I’m assuming you meanwindow 1 < 12.