Joined: 06 Jul 2010
Location: United States
Online Status: Offline
Posts: 6
Topic: Crystal Reports equivalent to sql query Posted: 06 Jan 2011 at 5:54am
Greetings.
I started out trying to do this in Crystal Reports 2k8 but couldnt quite accomplish what I was looking for. And the only way I could think to do this in sql was the following:
select s.pupil_number from students s where s.grade = '09' and s.school = 60 and s.withdraw_date is null minus select s.pupil_number from students s, course_selections cs, courses c where s.pupil_number = cs.pupil_number and cs.course_id = c.id and c.course_code = '0223' and s.grade = '09' and s.school = 60 and c.year = 2010 and s.withdraw_date is null;
The goal is just to find out which kids are not taking the course 0223.
Joined: 08 Jan 2011
Online Status: Offline
Posts: 20
Posted: 08 Jan 2011 at 8:22am
Have you tried:
select s.pupil_number from students s where s.grade = '09' and s.school = 60 and s.withdraw_date is null and s.pupil_number not IN ( select s.pupil_number from students s inner join course_selections cs ON s.pupil_number = cs.pupil_number inner join courses c ON cs.course_id = c.id Where c.course_code = '0223' and s.grade = '09' and s.school = 60 and c.year = 2010 and s.withdraw_date is null );
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum