Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query help in MS-Access

Status
Not open for further replies.

Swathi37

Vendor
Dec 23, 2002
77
US
Hi,
I have a question in Access.

CustID A# Type
------------------------------
0023 20 AB
0023 21 WI
0021 09 WI
0034 10 AB
0044 12 AB
0044 29 WI

My question is
If CustID has both AB and WI as Type I need to extract AB type custIDs, but if the custID has no AB but only WI I need to extract even this customer.

Is this possible?

The output should be
---------------------


CustID A# Type
------------------------------
0023 20 AB
0021 09 WI
0034 10 AB
0044 12 AB

How do I write the query?

Please help me out.

Thanks in advance.
 
This question is in the wrong forum, but here is your answer.
Create an initial query(Query1) containing CustId and Type, grouped on CustId and displaying the minimum for Type.
Now create a second query(Query2), join from your new query (including all records from new query) to initial table(Table1) (containing only matching records from initial table) on both the CustId and Type fields. Now display CustId and Type from Query1 and A# from Table1.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top