All pastes #448857 Raw Edit

Stuff

public text v1 · immutable
·published 2007-04-19 22:18 UTC
rendered paste body
// Here is my code :
$schools = $conn->query('select s.name from School s LEFT JOIN
                              s.SchoolVariableDatesCourse(name) variableCourse LEFT JOIN
                              s.SchoolFixedDatesCourse(name) fixedCourse LEFT JOIN
                              s.SchoolAccommodation(name) accommodation LEFT JOIN
                              s.SchoolTransfer(name) transfer LEFT JOIN
                              transfer.SchoolTransferPrice(one_way_price) transferPrice
                         where s.history_end_date IS NULL 
                               and variableCourse.history_end_date IS NULL 
                               and fixedCourse.history_end_date IS NULL 
                               and accommodation.history_end_date IS NULL 
                               and transfer.history_end_date IS NULL 
                               and transferPrice.history_end_date IS NULL 
                               and s.deleted = 0 
                               and variableCourse.deleted = 0 
                               and fixedCourse.deleted = 0
                               and accommodation.deleted = 0
                               and transfer.deleted = 0
                               and transferPrice.deleted = 0');

// And here is the generated sql :
SELECT s.id AS s__id, s.history_start_date AS s__history_start_date, s.name AS s__name FROM school s LEFT JOIN school_variable_dates_course s2 ON s.id = s2.school_id LEFT JOIN school_fixed_dates_course s3 ON s.id = s3.school_id LEFT JOIN school_accommodation s4 ON s.id = s4.school_id LEFT JOIN school_transfer s5 ON s.id = s5.school_id LEFT JOIN school_transfer_price s6 ON s5.id = s6.school_transfer_id WHERE s.history_end_date IS NULL                                  and variableCourse.history_end_date IS NULL                                  and fixedCourse.history_end_date IS NULL                                  and accommodation.history_end_date IS NULL                                  and transfer.history_end_date IS NULL                                  and transferPrice.history_end_date IS NULL                                  and s.deleted = 0                                  and variableCourse.deleted = 0                                  and fixedCourse.deleted = 0                                 and accommodation.deleted = 0                                 and transfer.deleted = 0                                 and transferPrice.deleted = 0