Subject | RE: [firebird-support] Re: Subselect doesn't work |
---|---|
Author | Alan McDonald |
Post date | 2004-11-25T18:12:43Z |
> >>Has somebody an idea why the current statement wouldn't workYes - use a SQL standard subselect instead...
> >>with firebird.
> >>
> >>SELECT triples.PREDICATE, triples.ARG0, triples.ARG1
> >> FROM (SELECT 'http://test#goodTitle' AS PREDICATE,
> >> triples.SUBJECT
> >> [snipped rest of select]
> >>
> >>
> >
> >This is not a subselect. This is called a derived table, FB 1.5 does
> >not support this. AFAIK support for derived tables is planed for V2.0
> >
> >Thomas
> >
> Is there any way how to use more values from subselect to parent select?
> i.e. SELECT p.id, (SELECT COUNT(ch.id) childcount, MAX(age) maxage FROM
> childs GROUP BY ..) FROM parents
> Any way to take childcount and maxage to parent select?
>
> Michal
SELECT FIELD1
, (SELECT COUNT(*) FROM TABLE2 WHERE TABLE2.PK=TABLE1.FK) AS MYCOUNT
, (SELECT MAXAGE(MYAGEFIELD) TABLE2 WHERE TABLE2.PK=TABLE1.FK) AS MYMAXAGE
FROM TABLE1
etc
Alan