On Tue, Jan 24, 2006 at 11:27:42PM -0600, Tim Wilson wrote:
> SELECT DISTINCT staff.id, CONCAT( staff.first_name, ' ',
> staff.last_name ) AS name
> FROM staff, staff_schools, staff_grades, staff_subjects, schools,
> grades, subjects
> WHERE staff.id = staff_schools.staff_id
> AND staff_schools.school_id = schools.id
> AND staff.id = staff_grades.staff_id
> AND staff_grades.grade_id = grades.id
> AND staff.id = staff_subjects.staff_id
> AND staff_subjects.subject_id = subjects.id
> AND (
> schools.abbrev = "ike"
> OR schools.abbrev = "mb"
> )
> AND (
> grades.abbrev = "gr5"
> )
> AND (
> subjects.abbrev = "socialstud"
> OR subjects.abbrev = "aom"
> )
>
> >>> staff_members = Staff.select(
> ... AND(
> ... OR(School.q.abbrev == "ike",
> ... School.q.abbrev == "mb"),
> ... Grade.q.abbrev == "gr5",
> ... OR(Subject.q.abbrev == "socialstud",
> ... Subject.q.abbrev == "aom")),
> ... distinct = True)
You have to add all straight joins yourself:
AND(..., Staff.q.id == StaffSubject.q.staffID, StaffSubject.q.subjectID ==
Subject.q.id...)
(just an example...)
Oleg.
--
Oleg Broytmann http://phd.pp.ru/ [EMAIL PROTECTED]
Programmers don't die, they just GOSUB without RETURN.
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss