era86
December 29th, 2011, 02:09 AM
SQL Wizards, I need your help!
I'm trying to put together a rather complex query using some obfuscated crazy framework... details aside, I'd like to do something like the following:
SELECT A.ATT_1, A.ATT_2, (SELECT COUNT(*) FROM TABLE_B) AS B_COUNT, A.ATT_3 FROM TABLE_A A WHERE B_COUNT = '2';
I keep getting an error that B_COUNT doesn't exist. Is there a way I can write conditions on the sub-query returned? Thanks so much in advanced!
:popcorn:
I'm trying to put together a rather complex query using some obfuscated crazy framework... details aside, I'd like to do something like the following:
SELECT A.ATT_1, A.ATT_2, (SELECT COUNT(*) FROM TABLE_B) AS B_COUNT, A.ATT_3 FROM TABLE_A A WHERE B_COUNT = '2';
I keep getting an error that B_COUNT doesn't exist. Is there a way I can write conditions on the sub-query returned? Thanks so much in advanced!
:popcorn: