>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