D
D
Dima_kras2016-01-25 07:41:23
SQL
Dima_kras, 2016-01-25 07:41:23

How to specify OR condition in SQL query?

Good afternoon, I'm doing a lab, there is a request to get data from the call table:
$query = "SELECT * FROM zvonki WHERE res1='0' AND date < '$data_pl' AND id_sp='67' ORDER BY 'id' ASC LIMIT 1 ";
Now the request includes calls with conditions:
res1=0
date<$data_pl
id_sp=67 The
question is how to request calls with one request:
res1=0
date<$data_pl
id_sp=67 or 68 I'm stupid
, I can't figure it out.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
DevMan, 2016-01-25
@Dima_kras

SELECT * FROM zvonki WHERE res1='0' AND date < '$data_pl' AND id_sp IN (67,68) ORDER BY 'id' ASC LIMIT 1

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question