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!

Only include fields not equal 1

Status
Not open for further replies.

surfbum3000

Technical User
Aug 22, 2003
156
US
I have 2 tables: tblReservedTime & tblAppts. I need to exclude the ReservedTime record if there is an appt. record in tblAppts. Both tables have the following fields in common:

Date
Location
EMP_ID
LastName
FirstName
StartTime
EndTime

I have tried the unmatched query wizard and then tried joining both tables on the above listed fields but I keep getting reserved time that has an appt. If the reserved time has an appt. in that slot, I want to exclude it.
 
I deleted fields in both tables that were not a match and I still get reserved time with an appt. scheduled. If I can find the solution somewhere I will come back and post the results or if anyone else has an idea let me know.

SELECT R.*
FROM tblxReservedTimeIntake AS R LEFT JOIN tblxAppts2Weeks AS A ON (R.EMP_ID = A.EMP_ID) AND (R.STARTDATE = A.STARTDATE) AND (R.LOCATE_ID = A.LOCATE_ID) AND (R.tblAnasaziStaff_LAST_NAME = A.tblAnasaziStaff_LAST_NAME) AND (R.tblAnasaziStaff_FIRST_NAME = A.tblAnasaziStaff_FIRST_NAME) AND (R.STARTTIME = A.STARTTIME) AND (R.ENDTIME = A.ENDTIME)
WHERE (((A.STARTDATE) Is Null) AND ((A.LOCATE_ID) Is Null) AND ((A.EMP_ID) Is Null) AND ((A.tblAnasaziStaff_FIRST_NAME) Is Null) AND ((A.tblAnasaziStaff_LAST_NAME) Is Null) AND ((A.STARTTIME) Is Null) AND ((A.ENDTIME) Is Null))
ORDER BY A.STARTDATE;
 
I called Microsoft and paid the $35 fee for assistance. Turns out PHV was right and the problem was the fact the data in the appointments table was not inclusive. When I originally posted, I did not know the software allowed closed cases to be scheduled; therefore, not all appointments were included in the table. This was why the results were not accurate. Thanks PHV.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top