I'm trying to generate a report of all courses in all curriculum's. My problem is that if two curriculum's have the same course, the query will bring them both. What I need if the course in both curriculum, fetch one of them only.
'curriculumcourses' Table: in this table are all courses in different curriculums.
The problem happen when for example:
course_id=1
curriculum_id=1
set_numer=0 //this row is not related to the problem
course_id=1
curriculum_id=2
set_numer=0 //this row is not related to the problem
The same course_id in different curriculum which is correct, but when I need to generate this report I don't need to show both courses I need just one. any help would be highly appreciated.
Here is the query I'm using
$result2 ="SELECT
*
FROM
curriculumcourses NATURAL
JOIN courses
WHERE semester_ava = '$avalablesemster'
AND curriculum_id IN
(SELECT
curriculum_id
FROM
curriculum
WHERE '".$coursneededdate."'
BETWEEN startdate AND enddate ";
if(!empty($gradunder)){
$result2 .=" AND grad_under = '".$gradunder."'";
}
$result2 .=")";