Subject Re: [firebird-support] How to return the value of a sub-query as a field in the resulting table
Author Paul Vinkenoog
Cornie wrote:

> Just a question: Why must "every filed that is not an aggregate must be in the group list"?

Because otherwise you may get different values in the same column within a single group. Imagine this table:

T
Name Age Sex Salary
-------------------------
John 23 M 1000
Jack 24 M 1250
Jill 23 F 1100

And this query:

select age, sex, max(salary) from t
group by age

What value would column Sex have for the row with Age = 23?


Paul Vinkenoog