开发者

SQL Query with Multiple Or On Statement

开发者 https://www.devze.com 2023-03-31 05:22 出处:网络
I was wondering if there is a way to write a statement with multiple OR in a better way. For example if i want to Select the users with Username A,B,C,D,E,F,G.

I was wondering if there is a way to write a statement with multiple OR in a better way. For example if i want to Select the users with Username A,B,C,D,E,F,G. With the SQL i already know i will write something like this

Select * From Users Where Username="A" OR Username="B".....

But if i had more usernames it will be a difficult to read statement. I was wondering if there is a bet开发者_StackOverflow中文版ter way to write that: Something like:Username={"A","B"....} Thank you.


USE - IN

 Select * From Users Where Username IN ("A","B"..)


SELECT * FROM Users WHERE Username IN ('A','B'...);
0

精彩评论

暂无评论...
验证码 换一张
取 消