Question

Locked

Access query question

I have a database with data as follows:
ID STATUS
12345 O
12345 O
54321 C
54321 O
45678 C
45678 O
78901 C
78901 C

I would like to know a query that will allow me to pull IDs that, in this case, have the same status in each occurence. For example, I would need to return 12345 since both records are STATUS = O and 78901 since both records are STATUS = C
Thanks!!

This conversation is currently closed to new comments.

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

All Answers

Collapse -

Microsoft Office How to Articles... below is a link

by CG IT In reply to Access query question

http://office.microsoft.com/en-us/help/FX100485361033.aspx?pid=CL100605171033

Collapse -

The SQL is

by Tony Hopkinson In reply to Access query question

Select ID, Status From
(Select ID,Status, Count(*) as NumberOfTimes Group By ID, Status) innerquery
Where NumberOfTimes > 1

In access if you are using the GUI, do the count query, then another query to select more than one occurence from that.

PS innerquery is just dummy name for the subquery in the parntheses, SQL requires a 'table name'

Back to Web Development Forum
3 total posts (Page 1 of 1)  

Related Discussions

Related Forums