Subject Re: [firebird-support] Getting distinct rows from a JOIN
Author Dimitry Sibiryakov
On 29 Mar 2005 at 17:11, salisburyproject wrote:

>I want to be able to get the following result from the select:
>1, V1, V1
>2, V2, V4
>, e.g. get only the first found raw from the joined table.

There is no 'first' record in SQL terms unless you specify oreder
criteria.

>SELECT T1.VALUE, T1.ID, T2.VALUE FROM T1 JOIN T2 ON (T1.ID=T2.ID)
>ORDER BY T1.ID

If you indeed don't care what value is returned from right table,
use this:

SELECT T1.VALUE, T1.ID, min(T2.VALUE) FROM T1 JOIN T2 ON
(T1.ID=T2.ID)
GROUP BY T1.ID, T1.VALUE
--
SY, Dimitry Sibiryakov.