Subject | Re: [firebird-support] Way to avoid many subselects |
---|---|
Author | Fabiano Bonin |
Post date | 2007-07-17T20:29:09Z |
Living and learning...
Very smart!
Thank you all.
Very smart!
Thank you all.
On 7/17/07, Arno Brinkman <fbsupport@...> wrote:
>
> Hi,
>
> > Very tricky :-) I would never imagine this. Thank you!
> >
> > Just for curiosity, do you figure out some way to do the same thing if i
> > can't use the ID?
> > for instance, if i want to order by invoice date desc and the table can
> have
> > duplicate dates for the same customer?
>
> SELECT
> r.RDB$RELATION_NAME,
> rf.RDB$FIELD_NAME
> FROM
> RDB$RELATIONS r
> LEFT JOIN RDB$RELATION_FIELDS rf ON (rf.RDB$RELATION_NAME =
> r.RDB$RELATION_NAME and
> rf.RDB$FIELD_NAME =
> (SELECT FIRST 1 srf.RDB$FIELD_NAME
> FROM RDB$RELATION_FIELDS srf
> WHERE srf.RDB$RELATION_NAME = r.RDB$RELATION_NAME
> ORDER BY srf.RDB$FIELD_ID ASC))
>
> Regards,
> Arno Brinkman
> ABVisie
>
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
> General database development support:
> http://www.databasedevelopmentforum.com
>
> Firebird open source database (based on IB-OE) with many SQL-99 features :
> http://www.firebirdsql.org
> http://www.firebirdsql.info
> http://www.fingerbird.de/
> http://www.comunidade-firebird.org/
>
> Support list for Firebird and Interbase users :
> firebird-support@yahoogroups.com <firebird-support%40yahoogroups.com>
>
> Nederlandse firebird nieuwsgroep :
> news://newsgroups.firebirdsql.info
>
>
>
[Non-text portions of this message have been removed]