I
I
iddddy2021-11-28 15:10:20
SQL
iddddy, 2021-11-28 15:10:20

How to add condition to SQL query?

Query displays new videos

SELECT A.*,B.UID,B.username 
FROM video A, signup B 
WHERE A.UID=B.UID AND A.active ='1' AND A.channel IN ('9') 
ORDER BY A.VID desc LIMIT 10

there is a condition that displays the restored videos

restored='yes' AND active_date = CURDATE()

how to combine them in one request so that both new and restored videos are displayed?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikolai Volkotyuk, 2021-11-29
@acces969

FROM video A
LEFT/INNER JOIN signup B
WHERE A.UID=B.UID
AND (A.active ='1' OR restored='yes') AND A.channel
IN ('9')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question