Simple question. As a single query, pull the values ​​of several cells by id (or something else). For example in the table

id | name ------------- 1 | Вася 2 | Серёжа 3 | Петя 4 | Федя 

Pull out only Fedya and Seryozh in one request. The first thing you want to write

  SELECT * FROM users WHERE id = 2 AND id = 4 

But logically this is of course nonsense =) Tell me how to make such a request correctly.

  • one
    Option 1: Derive those whose name is Fedya and Seryozha. Option 2: Bring out those whose name is Fedya or Seryozha. Choose the right ... - Akina
  • @Akina 1 The option does not work - Dmitriy

1 answer 1

 SELECT * FROM users WHERE id = 2 OR id = 4 

or

 SELECT * FROM users WHERE id IN (2, 4)