Question

Locked

Access 2000 Query

By MRA2 ·
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

This conversation is currently closed to new comments.

4 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Collapse -

Or

by Maevinn In reply to Access 2000 Query

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.

Collapse -

Thanks!!!!

by MRA2 In reply to Or

Thanks!!!


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

Alan

Collapse -

The short answer is

by Tig2 In reply to Thanks!!!!

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!

Collapse -

Glad to help.

by Maevinn In reply to Thanks!!!!
Back to Web Development Forum
4 total posts (Page 1 of 1)  

Related Discussions

Related Forums