Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Subselect in SELECT

Re: Subselect in SELECT

From: <gerald.deutsch_at_googlemail.com>
Date: 22 Jan 2007 11:38:09 -0800
Message-ID: <1169494689.104462.48970@38g2000cwa.googlegroups.com>


simply try adding a comma after persons.name and put the amount alias after the closing brace of the subquery, you want to use amount synonymous for the subquery, not as a qualifier within it. The way you coded it, the scope of amount is simply limited to the subquery, thus you can't use it in the from clause of the query.

chers, gerald

On 20 Jan., 17:12, Matthias Matker <kernkoe..._at_arcor.de> wrote:
> Hello together,
>
> SELECT
> persons.name
> ( SELECT COUNT(*) amount FROM person_cds WHERE ( person_cds.pname= persons.name))
> FROM
> persons
> WHERE ( amount< 280)
> ORDER by persons.name;
> EXIT;
>
> I want the name of the persons ( name is primary key of persons), which have fewer cds than 280.
>
> After executing this query, I got the Message,
>
> "amount" invalied identifier.
>
> Can you explain me, why?
>
> Thanks
Received on Mon Jan 22 2007 - 13:38:09 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US