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

Sean RhudyPresidentAsked:
Who is Participating?
 
Nick UpsonConnect With a Mentor Principal Operations EngineerCommented:
SELECT tblCountData.RecDate, sum(tblCountData.InCount), [cust per day].sum(CountOfSlcustkey)
FROM tblCountData INNER JOIN [cust per day] ON tblCountData.RecDate=[cust per day].Expr1;
group by 1
0
 
chaitu chaituCommented:
by looking at above Q i didnt understand much so can you post the sample data and the desired result you want?
0
 
Sean RhudyPresidentAuthor Commented:
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;
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.