Need help with another simple SQL statement


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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

chaitu chaituCommented:
by looking at above Q i didnt understand much so can you post the sample data and the desired result you want?
Nick UpsonPrincipal 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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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;
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Query Syntax

From novice to tech pro — start learning today.