Hey Folks,


    I've got a query that I'm trying to pull some aggregate data from and refer to it with array syntax. i.e. #queryname.field[i]#


One query I have isn't pulling all the values that I might encounter, thereby throwing the index off for any references thereafter. here's my query:


SELECT d.Disability, count(ed.DisabilityID) as Count
FROM Disabilities d LEFT OUTER JOIN EnrollmentsDisabilities ed
    ON d.DisabilityID = ed.DisabilityID JOIN Enrollments e
        ON ed.ProfileID = e.ProfileID AND ed.EnrollmentNumber = e.EnrollmentNumber
WHERE e.EnrollmentDate BETWEEN '#fromDate#' AND '#toDate#'
GROUP BY Disability
ORDER BY Disability

EnrollmentsDisabilities is a join table for a many-to-many relationship with Enrollments and Disabilities


I want all the possible values of Disability even if the count is zero. I thought the 'LEFT OUTER JOIN' syntax would take care of that, but it's not working. What am I doing wrong?


Thanks much!


John

---
John Venable
Director of Web Architecture
Epilepsy Foundation
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to