Information générale
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Michael,
The joins have to specify what they join:
>sele dl.date, dl.ofc;
__left(sh.repid,2) as mgr, sh.repid as repid, sh.project as project,;
__sh.pub as pub, CNT(sh.rescode) as Sales,;
__sum(th.hours) as Hours,sum(th.salecalls + th.refcalls) as Contacts,;
__cnt(cx.cxlby) as Cancels,;
FROM dailylog dl left join salehist sh ON dl.date,;
__salehist sh Left Join timehist th ON sh.repid,;
__salehist sh Left Join cancels cx ON sh.repid;
GROUP BY sh.repid, sh.project ;
INTO cursor qcDivStaRep
Should be more like
SELECT dl.date, dl.ofc;
__left(sh.repid,2) as mgr, sh.repid as repid, sh.project as project,;
__sh.pub as pub, CNT(sh.rescode) as Sales,;
__sum(th.hours) as Hours,sum(th.salecalls + th.refcalls) as Contacts,;
__cnt(cx.cxlby) as Cancels,;
FROM dailylog dl LEFT JOIN salehist sh ON dl.date = sh.date ;
LEFT JOIN timehist th ON sh.repid = th.repid ;
etc,
The general syntax is something like
FROM table1 LEFT JOIN table2 ON table1.field1 = table2.field 2
LEFT JOIN table3 ON table2.field2 = table3.field2
There are other ways too, but this should get you started. Check out the SELECT - SQL help item in VFP6
HTH,
Bill
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement