Subject | Re: [firebird-support] problem with grouping |
---|---|
Author | Helen Borrie |
Post date | 2006-02-24T10:15:08Z |
At 08:48 PM 24/02/2006, you wrote:
select
d.userid,
max(o.price)
from demand d
join offer o
on o.demandid = d.userid
group by 1
./heLen
>hi all,Of course you can use GROUP BY:
>
>have tables
>user
>--> demand (key userid)
> --> offer (key userid, demandid)
>
>Every offer has price.
>I need to select only best offers (grouped by userid) to a demand.
>Because I must group by all selected rows in FB,
>I cannot use GROUP BY, because I need to select offers' price as well.
>Any ideas?
select
d.userid,
max(o.price)
from demand d
join offer o
on o.demandid = d.userid
group by 1
./heLen