Link to home
Start Free TrialLog in
Avatar of Sean Rhudy
Sean RhudyFlag for United States of America

asked on

Need help with another simple SQL statement

Hello,

I have another simple question about my sql statement.  I am pulling from 2 different tables into this one table.  They are joined by date.  The tblCountData.InCount is pulling information from a door counter which counts how many people walk through the doorway.  Before, there was only one record per day for the number of people.  So this formula worked fine.  But now, the door counter manufacturer recommends that I pull data for every hour.  When I pull the data in, I need to have only one entry per day.  How can I accomplish that?
SELECT tblCountData.RecDate, tblCountData.InCount, [cust per day].CountOfSlcustkey, [cust per day].Expr1
FROM tblCountData INNER JOIN [cust per day] ON tblCountData.RecDate=[cust per day].Expr1;

Open in new window

Avatar of chaitu chaitu
chaitu chaitu
Flag of India image

by looking at above Q i didnt understand much so can you post the sample data and the desired result you want?
ASKER CERTIFIED SOLUTION
Avatar of Nick Upson
Nick Upson
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Sean Rhudy

ASKER

Thanks, that worked.  One more quick question.  How can I subtract 23 from sum(tblCountData.Incount) only if the value is greater than 0?

SELECT tblCountData.RecDate, sum(tblCountData.Incount) AS trafficcount
FROM tblCountData
GROUP BY tblCountData.RecDate;