Subject | Re: [ib-support] Searching for last record |
---|---|
Author | Andrew Guts |
Post date | 2002-06-18T13:38:02Z |
lele@... wrote:
function should return only one value or NULL.
Andrew
> >> update catalogue set last_location = (select location fromSure, but x.id is a primary key. And 'max(cx.id)' as an aggregate
> >> transfers x where x.catalog_id = catalogue.id and x.id =
> >> (select max(id) from transfers cx where cx.catalog_id =
> >> x.catalog_id))
> >>
> >>
> >>
> AG> By the way it's a surprise:
>
> AG> "Error: multiple rows in singleton select"
>
> AG> So "max()" could return multiple rows?. How nice.
>
>But that's not what probably happened! May be you have more LOCATIONs in
>TRANSFERS with the same ID...
>
function should return only one value or NULL.
>No way, thanks. Excuse me please.
>BTW, maybe you can get better results with something like
>
>UPDATE catalogue c
>SET c.last_location = (SELECT FIRST t.location
> FROM transfers t
> WHERE t.catalog_id = c.id
> ORDER BY id DESC)
>
>Not actually tried, just guessing if `FIRST' is good in this
>situation.
>
Andrew