Subject Re: [firebird-support] SELECT AS in a subquery
Author Steve Wiser
what about:

select count(*)
from tblusers t1
where exists (
select project_manager
from tblprojects
where project_manager = t1.username )

-steve

On Wed, 2005-11-16 at 16:33 +0000, dylanmarkow wrote:

> I have two tables, one with a column "USERNAME", the other with a
> column "PROJECT_MANAGER." Some of the people under USERNAME are
> also "Project Managers." I need to find out how many USERNAME's are
> also PROJECT_MANAGER's.
>
> I tried this, but it said "Token Unknown - AS":
>
> SELECT COUNT(*) FROM TBLUSERS WHERE USERNAME IN (SELECT
> PROJECT_MANAGER
> AS USERNAME FROM TBLPROJECTS)
>
> If i remove the "AS USERNAME", it returns zero, since the fields
> don't
> match up.
>
> I'd like to avoid manually iterating through TBLUSERS, checking each
> user individually. Any suggestions?
>
>
>
>
>
>
>
> ------------------------ Yahoo! Groups Sponsor
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Visit http://firebird.sourceforge.net and click the Resources item
> on the main (top) menu. Try Knowledgebase and FAQ links !
>
> Also search the knowledgebases at http://www.ibphoenix.com
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
>


[Non-text portions of this message have been removed]