Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to select multiple names in a single query

Tags:

sql

I have a sql query which is like that

 select * 
 from users 
 where uname="ali" and uname="veli"

but it is not worked what ı want to do is get the person whose name is "ali" and "veli" but if "ali" is not exist and "veli" is exist, the existed ones should be return. How can I do this. it is easy query but I am confusing.

like image 302
EmreAltun Avatar asked Nov 30 '22 02:11

EmreAltun


1 Answers

Try this:

 SELECT * 
 FROM users 
 WHERE uname IN ("ali", "veli")
like image 56
Mahmoud Gamal Avatar answered Dec 01 '22 16:12

Mahmoud Gamal