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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select query help 1

Status
Not open for further replies.

brettgab

Programmer
Aug 29, 2001
13
AU
I have a table from which I need to select all records with a 'matching pair of fields'.

For example my table contains the following structure, and the fields I'm matching are FIELD1 and FIELD3

ID FIELD1 FIELD2 FIELD3
1 Bob Ted Reg
2 Bob Peter
3 Bob Chris Peter
4 Ted Jane Eric
5 Ted Jane Robert
6 Ted Rachel Eric

In this instance, I want my query to return the following results (ideally, grouped).

FIELD1 FIELD3
Bob Peter
Ted Eric

How do I do this ?



 
Hi,

use DISTINCT to select different lines.

Regards

Fcail
 

This should do it.

Select Field1, Field3
From Table
Group By Field1, Field3
Having count(*)>1 Terry L. Broadbent
FAQ183-874 contains tips for posting questions in these forums.
NOTE: Reference to the FAQ is not directed at any individual.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top