Answer the question
In order to leave comments, you need to log in
How to make a request correctly or what alternative can be done in php?
The task is such that I have cities in a table with id, I received several ids and I need to get them all, I see two options here through in or make several queries through a loop or a function call. In in when two identical ids come to me, only one city for two id will be returned to me, in the second case, it’s probably not reasonable to make a query to the database every time, tell me what to do, it’s not necessary to change the logic in sql, you can also in php
Answer the question
In order to leave comments, you need to log in
In in when two identical ids come to me, only one city for two id will be returned to me
(something like that, but not tested...)
SELECT *
FROM `table`
WHERE EXISTS(select 1 from `table` WHERE id IN (1,1,3,1,5))
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question