xeonman13;10988680 wrote:
Scheduled courses table has a list of courses, one column on that table is locationsid and another is coursetypes id.
All of which are unique combinations, thus being distinct to begin with
xeonman13;10988680 wrote:
I need to pull a list of course types, filtered by location.
LEFT OUTER JOIN coursetypes ON (scheduledcourses.coursetype=courset
You have not provided a complete query, and since there is no where clause, there is no way to tell if this query really is filtering the result by a specific location.
xeonman13;10988680 wrote:
This query needs to be DISTINCT but its not working. The query returns information but its duplicate data.
No it doesn't. DISTINCT means the returned data will be distinct for each row. Thus
SELECT DISTINCT locationsid, coursetypeid
FROM scheduledcourse
SELECT DISTINCT coursetypeid
FROM scheduledcourse
these queries do not provide the same number of rows (unless each coursetypeid only appears once).
However, assuming that (locationid, coursetypeid) has to be unique, then adding
WHERE locationid = @someId
to both of the above queries then they would retrieve the same number of rows.