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

Filter by Yes/No

Status
Not open for further replies.

topwaya

Technical User
May 4, 2005
150
US
I have a query that I would like to show how many people work out at each Fitness Center site - that do not work at a Fitness Center site.

Fields:
tblPersonal.LocW = work location
qryFCVisitsPID.WOLoc = workout location
tblPersonal.FCSite if checked is an FCSite (Yes/No)

My current code is:
Code:
SELECT qryFCVisitsPID.PID AS qryFCVisitsPID_PID, qryFCVisitsPID.WOD, qryFCVisitsPID.WOTme, qryFCVisitsPID.WOLoc, tblLoc.LocID, tblLoc.FCSite, tblPersonal.LocW
FROM tblPersonal, tblLoc INNER JOIN qryFCVisitsPID ON tblLoc.LocID = qryFCVisitsPID.WOLoc;

How do I write that I want to only show people who's LocW is not checked as a FCSite?

Thank you for any help!!



 
add this to the end of your query...

WHERE tblPersonal.FCSite='No'

-DNG
 
Thank you so much for your quick response!
The problem with that, is that I want to show what site they worked out at so all the (qryFCVisitsPID.WOLoc = workout location) will be FCSites.

But I don't want the tblPersonal.LocW to be a tblLoc.FCsite that is checked as YES.

btw- I mistyped in my first post about the fields. Where I typed:
tblPersonal.FCSite if checked is an FCSite (Yes/No)
it should read:
tblLoc.FCSite if checked is an FCSite (Yes/No)

Thank you for your patience!

 
I figured it out - thank you for your help - it made me THINK :)!

I had to make an alias table for tblLoc so that I could establish a relationship between the FCSite and the LocW without effecting the relationship between the FCSite and the WOLoc.

Here is what I have now and it appears to work:
Code:
SELECT qryFCVisitsPID.PID AS qryFCVisitsPID_PID, qryFCVisitsPID.WOD, qryFCVisitsPID.WOTme, qryFCVisitsPID.WOLoc, tblLoc.LocID, tblLoc.FCSite, tblPersonal.LocW, A.LocID, A.FCSite
FROM tblLoc INNER JOIN qryFCVisitsPID ON tblLoc.LocID = qryFCVisitsPID.WOLoc, tblPersonal INNER JOIN tblLoc AS A ON tblPersonal.LocW = A.LocID
WHERE (((A.FCSite)=No));

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top