General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
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
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only