Subject Re: Selecting distinct
Author Adam
--- In firebird-support@yahoogroups.com, "sasidhardoc"
<madhusasidhar@...> wrote:
>
> For a query such as "SELECT ID, f1, f2 FROM t1......" is it possible
> to return records that have distinct values in some columns only?
> "SELECT DISTINCT ID, f1, f2 FROM t1......" does not work because ID is
> always a distinct value. TIA!
>

Your desired query does not make sense.

Imagine

ID F1 F2
1 1 1
2 1 1

and imagine your desired query syntax existed. It should return

ID F1 F2
?? 1 1

Should it return 1 or 2 in your ID field.

You can use an aggregate if you don't care.

SELECT Min(ID), f1, f2
from ...
group by f1, f2

Adam