473,320 Members | 1,831 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

quey help


Excuse me for not putting a better name to this but I cannot think of a
suitable subject title!

anyway, here's what I am trying to do

At work we have a fair amount of data that is to do with people and what
jobs they have completed and at what date
so for example
Joe Bloggs did design work at 12/12/2004 and spent 5 hours on it.
Now, we have a lot of jobs that people haven't put any hours down for at
all,
and I want to find all those jobs which have had no hours put to them since
the 30/09/2004
I had written a query like so
SELECT name, job, date
FROM table
WHERE hours = 0 AND date >='30/09/2004'
But this doesn't work as some jobs may come up which have had zero hours on
some particular dates but on some dates that job does have hours on.
What I want is to show since 30/09/2004 any jobs which have had no hours at
all booked to them consistently.
So in effect all the jobs we know longer use and haven't since that date.

How would I do that?
I know you can probably only give me a vague idea as I have provided no
table structure etc.. but I only want a hint really...

Thanks

Jayne
Jul 23 '05 #1
2 991
On Tue, 26 Apr 2005 20:32:23 +0100, Little PussyCat wrote:

(snip)
What I want is to show since 30/09/2004 any jobs which have had no hours at
all booked to them consistently.
So in effect all the jobs we know longer use and haven't since that date.

How would I do that?
Hi Jayne,

Try if this works:

SELECT job
FROM table
WHERE date >= '20040930' -- Note the unambiguous date format!
GROUP BY job
HAVING SUM(hours) = 0

However, this requires that there are rows for the job in the table, with
a number of hours equal to 0. If the table has no rows in the specified
date range for the the job, then this query won't find them.
I know you can probably only give me a vague idea as I have provided no
table structure etc.. but I only want a hint really...


If the above doesn't work and you need better hints, then check out this
site before posting a followup: www.aspfaq.com/5006.

Best, Hugo
--

(Remove _NO_ and _SPAM_ to get my e-mail address)
Jul 23 '05 #2
Hi Jayne,

Would something like this work?

SELECT
t.name,
t.job,
t.date
FROM
table t join
(select name, job, sum(hours) as hours from table where date
='30/09/2004' group by name, job having sum(hours)=0)dt

on t.name=dt.name and t.job=dt.job
WHERE
t.date >='30/09/2004'

Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
by: Dave | last post by:
After following Microsofts admonition to reformat my system before doing a final compilation of my app I got many warnings/errors upon compiling an rtf file created in word. I used the Help...
6
by: wukexin | last post by:
Help me, good men. I find mang books that introduce bit "mang header files",they talk too bit,in fact it is my too fool, I don't learn it, I have do a test program, but I have no correct doing...
3
by: Colin J. Williams | last post by:
Python advertises some basic service: C:\Python24>python Python 2.4.1 (#65, Mar 30 2005, 09:13:57) on win32 Type "help", "copyright", "credits" or "license" for more information. >>> With...
7
by: Corepaul | last post by:
Missing Help Files When I enter "recordset" as the keyword and search the Visual Basic Help index, I get many topics of interest in the resulting list. But there isn't any information available...
0
by: KemperR | last post by:
Dear All, I have a very hard time with an ACCESS 2000 crosstab query. The basic query the crosstab is based on looks like this: SELECT DokumenteNachNummer.Dokumente_ID ,...
3
by: touf | last post by:
Hi, I like to create a query builder to allow the user to create his statistics and see them using Cristal report Any idea about how to do this, is there any controls that can help me. Thanks.
5
by: Steve | last post by:
I have written a help file (chm) for a DLL and referenced it using Help.ShowHelp My expectation is that a developer using my DLL would be able to access this help file during his development time...
5
by: TimHop12 | last post by:
Hi all, The query below is not compiling. Please help: Select case when isNull(a.,0)=0 Then char(43) when isNull(t.,0)=0 Then char(45) else char(160) end as ind, count(*)...
1
by: ravi | last post by:
hi friends, The below given query is work on oracle.Help me out write same query on sqlserve i want the same resule. select * from (select trunc(sysdate) + level from dual 2 connect by level...
1
by: rparcha | last post by:
How to convert following MS access quey to SQL server statement ACCESS: Testx: IIf(Mid(dbo_ITMaster!City,1,2)="AB",IIf(Mid(dbo_ITMaster!Plan,1,3)<>"XYZ","M",IIf(dbo_ITMaster!Center="1111", "A",...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.