Subject Re: [firebird-support] return max 1 row from one of tables in a join
Author Matt Clark
On Mon, 2003-10-13 at 15:57, Milan Babuskov wrote:
> Matt Clark wrote:
> > problem is, if there is more than one matching row in locations, I still
> > only want exactly 1 row per sku in the top level.
>
> But which one?
Doesn't matter. If there is more than one, that's someone else's problem
so I'll just take the first.

> If you using firebird, you can try to do the subselect (in select
> clause) with FIRST, something like:
>
> select colX, (select first 1 colY from locations l where l.sku = i.sku)
> from item_history i;
Going home soon but a quick test of the above looks like it should work
perfectly.
Didn't realise you could put a subquery there :)

Thank you very much for that Milan

regards mattc


Maplin Electronics Ltd.
www.maplin.co.uk

This message is intended only for the use of the person(s) ("The intended
recipient(s)") to whom it is addressed. It may contain information which is
privileged and confidential within the meaning of applicable law. If you
are not the intended recipient please contact the sender as soon as possible.
The views expressed in this communication may not necessarily be the views
held by Maplin Electronics Ltd.