SQL - Stumped on a SELECT - please help!

后端 未结 6 1132
悲&欢浪女
悲&欢浪女 2021-01-27 17:52

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         


        
6条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-27 18:28

    Certainly it's possible. If you have two tables, Usernames with all the taken user names, and Emails with all the taken emails, this query would return all the rows that either have the same username or the same email.

    SELECT * FROM Usernames, Emails WHERE Usernames.Name = 'username' OR Emails.Email = 'email'
    

提交回复
热议问题