If statements and record count (SQL)

I’m looking to make my code a little more efficent. Right now I have a coldfusion script that runs queryA. If queryA’s record count is 0, I then run queryB. I perform the test for the record count with coldfusion and then if there are no records returned, I go back to the database and run queryB. Is it possible to perform the test using SQL (I’m on a SQL Server 2000 DB), so I only have to hit the database once instead of going back and hitting it again if nothing is returned in queryA? If so, how?

Thanks for your help

i’m not sure if this will run as one CFQUERY execution (through ODBC? i dunno, i don’t use SQL Server with CF) but it works just fine in my WinSQL GUI as a single call

if (select count(*) from table1) > 0
select foo, bar from table1
else select qux, fap from table2