Answer the question
In order to leave comments, you need to log in
How to make a selection based on two conditions of one field?
There is such a table ...
you need to get all id_users that were at the point id_ap = 1 and at id_ap = 118 with one query
separately WHERE id_ap= 1 - 366 lines
WHERE id_ap = 118 - 1120 lines
made such a request ... but I don’t understand a little it
displays 308 lines ... that is, it counts only those who were at 1 by 118, but it is necessary that everyone take
SELECT vizits.id_user, id_ap FROM vizits WHERE id_ap IN (1,118) GROUP BY id_user HAVING COUNT(id_ap)=2
Answer the question
In order to leave comments, you need to log in
if both on that and on that - then HAVING COUNT(DISTINCT id_ap) = 2, if on any - then generally remove having
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question