Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Union select
Message
From
22/06/2000 12:49:12
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Union select
Miscellaneous
Thread ID:
00383252
Message ID:
00383252
Views:
48
I have a union select statement that I can't figure out where the problem is. I want to count all the students who haven't completed a course and have no dropdate unless the dropdate is 1 month or more after the startdate. So I combined my select statements with a union select. The problem is I get a syntax error.

Here is my select statement:

select courseprogram.programid, studentcourse.courseid, &groupchoice as mygroup,;
instructor.ifname, count(studentcourse.instructorid) as numstud, studentcourse.instructorid,;
nvl(program.program, " ") as program;
from studentcourse left join instructor on studentcourse.instructorid = instructor.instructorid,;
courseprogram left join program on courseprogram.programid = program.programid;
where courseprogram.courseid = studentcourse.courseid;
and studentcourse.startdate >= {12/01/1999};
and studentcourse.dropdate != {};
and month(studentcourse.dropdate) - month(studentcourse.startdate) >= 1;
or year(studentcourse.dropdate) - year(studentcourse.startdate) >= 1;
and studentcourse.iscomplete = .F.;
union select courseprogram.programid, studentcourse.courseid, &groupchoice as mygroup,;
instructor.ifname, count(studentcourse.instructorid) as numstud, studentcourse.instructorid,;
nvl(program.program, " ") as program;
from studentcourse left join instructor on studentcourse.instructorid = instructor.instructorid,;
courseprogram left join program on courseprogram.programid = program.programid;
where courseprogram.courseid = studentcourse.courseid;
and studentcourse.startdate >= {12/01/1999};
and studentcourse.dropdate == {};
and studentcourse.iscomplete = .F.;
into cursor clbudgetnew;
group by mygroup, studentcourse.courseid, studentcourse.instructorid


Where could the syntax error be? Just need some help getting this to work.

TIA,
Tyler
Next
Reply
Map
View

Click here to load this message in the networking platform