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!

Line not showing up in a query

Status
Not open for further replies.

Guinfan

Technical User
Jun 12, 2005
5
US
I have a query that is working, almost. There are a few items in "MOI" table where the value is 0. When I run the query, those items are not showing up. I would like for them to show with a value of 0. I used the design wizard to make the query. I was hoping someone could go through the SQL code and help me out. Thanks alot!

SELECT MOI2.MOI, Count(InjuryInfo4.MOI) AS CountOfMOI
FROM (Gender2 INNER JOIN PatientInfo2 ON Gender2.Gender = PatientInfo2.Gender) INNER JOIN (MOI2 INNER JOIN InjuryInfo4 ON MOI2.MOI = InjuryInfo4.MOI) ON PatientInfo2.PatientID = InjuryInfo4.PatientID
GROUP BY MOI2.MOI, Gender2.Gender
HAVING (((Gender2.Gender)="Female"));
 
Perhaps this ?
SELECT MOI2.MOI, Count(InjuryInfo4.MOI) AS CountOfMOI
FROM (MOI2
LEFT JOIN InjuryInfo4 ON MOI2.MOI = InjuryInfo4.MOI)
LEFT JOIN PatientInfo2 ON InjuryInfo4.PatientID = PatientInfo2.PatientID
WHERE PatientInfo2.Gender='Female' OR PatientInfo2.Gender Is Null
GROUP BY MOI2.MOI;

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top