dagger2002
Programmer
Hello every one
I am working on a query set that needs to sort the data 3 times. Here are the existing query sets:
The table structure goes like this
and here is what i have tried for my join but am getting a 1064 error
Thanks all in advanced
I am working on a query set that needs to sort the data 3 times. Here are the existing query sets:
Code:
// Builds Class Query
// $query99 = "SELECT * FROM class WHERE cour_id = " . $row[cour_id] . " AND clas_active = 1 ORDER BY clas_sTime ASC";
$query99 = "SELECT * FROM class WHERE cour_id = " . $row[cour_id] . " AND clas_active = 1 ORDER BY schoo_cdsCode ASC";
$result99 = mysql_query($query99) or die/*(mysql_error());//*/("Class Problem Query");
$numRows99 = mysql_num_rows($result99);
$row99 = mysql_fetch_array($result99);
// Builds School Query
$queryCDS = "SELECT * FROM school WHERE cdsCode = " . $row99[schoo_cdsCode];
$resultCDS = mysql_query($queryCDS) or die/*(mysql_error());//*/("No Classes available at this time. Please try again later.");
$numRowsCDS = mysql_num_rows($resultCDS);
$rowCDS = mysql_fetch_array($resultCDS);
// Builds District
$queryDist = "SELECT * FROM district WHERE cdsCode = " . $rowCDS[dist_cdsCode];
$resultDist = mysql_query($queryDist) or die/*(mysql_error());//*/("No Classes available at this time. Please try again later.");
$numRowsDist = mysql_num_rows($resultDist);
$rowDist = mysql_fetch_array($resultDist);
The table structure goes like this
Code:
District :|: School :|: Class :|: Course
and here is what i have tried for my join but am getting a 1064 error
Code:
SELECT
class.clas_id, class.clas_semester, class.clas_sMonth, class.clas_sDay, class.clas_eMonth, class.clas_eDay, class.clas_sTime, class.clas_eTime, class.clas_dayM, class.clas_dayT, class.clas_dayW, class.clas_dayTH, class.clas_dayF, class.clas_dayS, class.clas_blo, class.clas_active, class.cour_id, class.schoo_cdsCode,
course.cour_id, course.cour_Code, course.cour_name, course.cour_description, course.cour_hours, course.cour_hrExt, course.cour_note, course.cour_preReq, course.cour_active, course.sect_id
school.schoo_id, school.cdsCode, school.dist_cdsCode, school.sname,
district.dist_id, district.cdsCode, district.dist_name, district.phone
FROM `class` LEFT JOIN `school` ON class.schoo_cdsCode = school.cdsCode
FROM `school` left join school.dist_cdscode = district.cdsCode
WHERE class.cour_id = 1 AND class.clas_active = 1
Thanks all in advanced