Skip to content
Advertisement

SQL SELECT two specific names from table not working

Name UID Late
Tin ABC 0
Bob ABC 0
SELECT * FROM `logs` WHERE Name='Tin' AND Name='Feryal'

This query returns nothing for me and only works when I want one name. I could use the SELECT * but for this case I would like to call specific names in the query?

Advertisement

Answer

For this use In clause.

SELECT * FROM logs WHERE Name IN ('Tin', 'Feryal');

You can also use or clause

SELECT * FROM logs WHERE Name='Tin' OR Name='Feryal'
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement