no zeroes returned

A

alphamisanthrope

Firstly, here's the query:
SELECT tblTime.Hour, Count(*) AS HowMany
FROM tblStay, tblTime
WHERE tblTime.Hour Between [tblStay].[TimeIn] And [tblStay].[TimeOut]
GROUP BY tblTime.Hour;

tblTime is just a list of every hour
tblStay has two columns timeIn, timeOut

The query works, I get a head count by hour, but I can't get zeroes to
return when Null. The hour is question is skipped. I tried Nz in every
conceivable place. I've tried a couple of if statements, but no luck

See what you think.
 
G

Guest

Save your "Firstly" query and then use it in a new query that does an outer
join on tblTime.
 
M

Marshall Barton

alphamisanthrope said:
Firstly, here's the query:
SELECT tblTime.Hour, Count(*) AS HowMany
FROM tblStay, tblTime
WHERE tblTime.Hour Between [tblStay].[TimeIn] And [tblStay].[TimeOut]
GROUP BY tblTime.Hour;

tblTime is just a list of every hour
tblStay has two columns timeIn, timeOut

The query works, I get a head count by hour, but I can't get zeroes to
return when Null. The hour is question is skipped. I tried Nz in every
conceivable place. I've tried a couple of if statements, but no luck

See what you think.


Please don't post the same question multiple times. Check
for other answers in other groups.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top