Subject | SELECT AS in a subquery |
---|---|
Author | dylanmarkow |
Post date | 2005-11-16T16:33:18Z |
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?
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?