Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sort not working as expected
Message
 
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Vista
Network:
Windows 2008 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01361158
Message ID:
01361332
Views:
27
>Sure
>
>"SQL group clause missing or invalid" under engine 90
>
>Now remember this was just a "first cut" stab at the SQL and I've trried many permutations, including "group by 1, 4"
>
>
>Select JobAct.OurInvID, jobheads.JobID, SUM( jobheads.Quantity) as Booked, SUM( jobact.hours) as Charged, JobHeads.LabourID ;
>  from jobact, jobheads ;
>  where jobheads.JobID = jobact.JobID ;
>  AND jobAct.JobID = "RTvo" ;
>  and not EMPTY( JobAct.OurInvID) ;
>  group by OurInvID, LabourID ;
>  into cursor JobsS
>
>
>What exactly IS VFP 9's problem with this (remember I've only been using 9 for 2 months now)

This query also needs a group by jobheads.JobID. All fields which are not in aggregate function MUST be listed in GROUP BY. So, the rule is very simple: either field should be one of the aggregate functions (MIN, MAX, AVG, COUNT, SUM) or it should be in GROUP BY list of the fields.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform