dantheinfoman
Programmer
Hi All,
I've scoured the web, but everything is pretty vague about fixing these old SQL statements from VFP 7 to the new strict/compliant VFP 9 guidelines.
Here's one such example (of many many statements I'll have to fix):
Code:
SET ENGINEBEHAVIOR 70
DO SYCOMBAN WITH 'tktimcrd','TKTIMCRD','TK_ARCH' &&02/26/01vb to make it work w/SYCOMBAN
SELECT tktimcrd.*, SUM(tktimcrd.HOURS) AS SUM_HOURS,SUM(tktimcrd.flatamount) AS SUM_flat;
FROM tktimcrd ;
WHER (work_date BETWEEN m.D_BeginDate AND m.D_EndDate) ;
GROUP BY tktimcrd.Employee, tktimcrd.JOB, tktimcrd.work_date, tktimcrd.pay_type ;
ORDER BY tktimcrd.Employee, tktimcrd.JOB, tktimcrd.work_date, tktimcrd.pay_type ;
INTO CURSOR QUERY
SELECT QUERY
SET RELA OFF INTO PY_EMPLO
SET RELATION TO Employee INTO PY_EMPLO ADDI
SET RELA OFF INTO SYJOBCST
SET RELATION TO JOB INTO SYJOBCST ADDI
m.JoinFile = .T. &&VB
SET ENGINEBEHAVIOR 90
I've read that all the fields that are non-aggregate (I think that means all fields that are not calculations, such as SUM, COUNT etc) must be re-listed on the GROUP BY statement.
Does that mean I should just say GROUP BY tktimcrd.* and get it over with? What happens if I remove the Group By clause completely? I don't really understand what the GROUP BY statement does, especially if all fields must be mentioned in the group, it seems like they don't do much of anything.
Thanks!
Dan