Question Locked

Access 2000 Query

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I have an MS Access 2000 table. It contains an ID Number, Year and Amount.

I would like to select ONLY those ID Numbers where the Year = 2006 and the amount > 0

AND

where the year = 2007 and the amount = 0.

Example:
ID Number 1
Year 2006 2006 amount $10.00
Year 2007 2007 amount = 0
Select this one

ID Number 2
Year 2006 2006 amount = $5.00
Year 2007 2007 amount = $5.00
DON'T SELECT THIS ONE!

I tried this query and it does NOT WORK

SELECT CONTRIBS.ID, CONTRIBS.Year, CONTRIBS.AMOUNT
FROM CONTRIBS
WHERE( (((CONTRIBS.Year)="2006")) AND (((CONTRIBS.AMOUNT)>0)) and (((CONTRIBS.Year)="2007") AND ((CONTRIBS.AMOUNT)=0)))
ORDER BY CONTRIBS.ID;

Any help you can offer would be greatly appreciated...

Thanks,
Alan

5 replies

by maevinn

SELECT CONTRIBS.ID, CONTRIBS.Year, CONTRIBS.AMOUNT
FROM CONTRIBS
WHERE( (((CONTRIBS.Year)="2006") AND ((CONTRIBS.AMOUNT)>0)) OR(((CONTRIBS.Year)="2007") AND (CONTRIBS.AMOUNT)=0)))
ORDER BY CONTRIBS.ID;

Bracket the first set of conditions together, OR, bracket second set of conditions together.

by mra2

Thanks!!!

How do I inactivate this question so no one else bothers answering it??

Alan

by tig2

You don't. You have to take it on faith that people will read the thread and recognise that you have received the necessary answer. Mayven will know from the thumbs up sign that you were helped by her answer.

I wouldn't worry- some folks come in, ask away, get numerous responses, and never come back... unless they have another question. We always appreciate a peer who acknowledges that their question has been answered!

This discussion is closed to new replies.