I\'m trying to achieve the following in SQL Server 2005:
SELECT (IF EITHER EXISTS) usr.username, pro.email FROM table1 AS usr, table2 AS pro WHERE usr.username = \'ex
select usr.username, pro.email
from table1 as usr
inner join table2 as pro on
usr.id = pro.userId --I'm guessing on the relationship here
where
usr.usrname = 'existing_username' or
pro.email = 'existing_email'
Alternately, you could union results from both tables together:
(select username, null as email from table1)
union
(select null as username, email from table2)
The union will give you results if you don't have a relationship between the tables.