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

View records when two fields are equal

Status
Not open for further replies.

surfbum3000

Technical User
Aug 22, 2003
156
US
In my table tbl2DaysAppts I would like to only view the records where the date and 2 names are equal. The query below does not provide this information. Any assistance is appreciated.

Code:
SELECT tbl2DaysAppts.tblAnasaziStaff_LAST_NAME, tbl2DaysAppts.STARTDATE
FROM tbl2DaysAppts
WHERE (((tbl2DaysAppts.tblAnasaziStaff_LAST_NAME) In ('SCARDINO','WRIGHT')) AND ((tbl2DaysAppts.STARTDATE)=[tbl2DaysAppts].[STARTDATE]))
ORDER BY tbl2DaysAppts.STARTDATE;
 
Try this:
Code:
SELECT A.tblAnasaziStaff_LAST_NAME, A.STARTDATE
FROM tbl2DaysAppts A
INNER JOIN tbl2DaysAppts B ON A.tblAnasaziStaff_LAST_NAME = B.tblAnasaziStaff_LAST_NAME AND A.STARTDATE = B.STARTDATE
WHERE A.tblAnasaziStaff_LAST_NAME In ('SCARDINO','WRIGHT')) 
ORDER BY A.STARTDATE;

Leslie

Anything worth doing is a lot more difficult than it's worth - Unknown Induhvidual

Essential reading for database developers:
The Fundamentals of Relational Database Design
Understanding SQL Joins
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top