Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Union select
Message
De
22/06/2000 12:49:12
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Union select
Divers
Thread ID:
00383252
Message ID:
00383252
Vues:
47
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform