help with a querie

lcross

Registered User.
Local time
Today, 06:51
Joined
Aug 30, 2005
Messages
39
i have 2 tables jobs and jobs_details jobs have the fields name date account etc.
jobs_details have the print area, file, etc.
i need a querie to give me the total print area for each account on a particular date but i can't get it to work.
I've tryed this:
"SELECT DISTINCT jobs.Account, Sum(jobs_details.PlottedArea) AS SomaDePlottedArea, Sum(jobs_details.UsedArea) AS SomaDeUsedArea, jobs.JobDate
FROM jobs LEFT JOIN jobs_details ON jobs.JobID = jobs_details.JobID
GROUP BY jobs.Account, jobs.JobDate
HAVING (((jobs.JobDate) Between #3/1/2005# And #4/1/2005#))
ORDER BY jobs.Account;"
but it returns all the jobs.Account(it doesn't give the distinct) by all the dates

what am i doing wrong???
 
Unless I missed an error in the SQL, this should return each unique occurance of Account AND JobDate between 3/1/2005 and 4/1/2005
What are you getting?
 
problem is i need the total area divided by account on a date interval (like a mounth)
and it returns individual values per day, per account.
 
Just for kicks, try this:
SELECT DISTINCT jobs.Account, Sum(jobs_details.PlottedArea) AS SomaDePlottedArea, Sum(jobs_details.UsedArea) AS SomaDeUsedArea
FROM jobs LEFT JOIN jobs_details ON jobs.JobID = jobs_details.JobID
GROUP BY jobs.Account
HAVING (((jobs.JobDate) Between #3/1/2005# And #4/1/2005#))
ORDER BY jobs.Account;
 
yep, that's it i already had it working but thanks anyway.
you know how it is, go for a coffe and when returns the solution is right there in front of you...
thks.
 

Users who are viewing this thread

Back
Top Bottom