Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Query Problem
Message
From
18/07/2000 09:32:53
Mark Hall
Independent Developer & Voip Specialist
Keston, Kent, United Kingdom
 
 
To
18/07/2000 09:01:41
General information
Forum:
Visual FoxPro
Category:
Client/server
Title:
Miscellaneous
Thread ID:
00393731
Message ID:
00393752
Views:
15
>Hi,
>
>I'm trying to consruct a query which I can send to VFP, Oracle or SQL Server and get the same result. The query, which works fine with VFP, is as follows:
>
>Select training.idtraining, training.course, training.subject, training.held from training group by course
>
>i.e. I want a resulting cursor with these fields, where the course field contains unique values.
>
>For Oracle, I get the error:
>
>Not a GROUP By expression
>
>In SQL Server, I get the error:
>
>Column 'training.idtraining' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
>
>The table structures are the same for all three.
>
>How do I get the result set I want from Oracle and SQL Server ?
>
>Best.
>
>Matt.


Hi,

Do you really want a GROUP BY here? You don't have any aggregate fields (SUM(), MAX(), etc)

For 'standard' SQL you have to include all non-aggregate SELECTed fields in the GROUP BY Clause,

Maybe you just need a SELECT Distinct?

i.e.
Select DISTINCT training.idtraining, training.course, training.subject, training.held from training
Regards
Mark

Microsoft VFP MCP
Menulib - OO Menus for VFP www.hidb.com/menulib
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform