T
T
TechNOIR2018-05-14 08:21:36
MySQL
TechNOIR, 2018-05-14 08:21:36

SQL. How to combine two queries in this case?

Good afternoon.
There are 2 tables doctors and testt.
And I need to execute 2 requests. First in table testt by date:

SELECT * FROM testt WHERE '2018-05-13' BETWEEN date_in AND date_out

And then from two tables:
SELECT * FROM doctors, testt WHERE testt.sec = doctors.id

How would you put it all in one request? thanks in advance

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Ivan, 2018-05-14
@TechNOIR

Learn SQL: join

SELECT 
testt.*, 
doctors.* 
FROM testt 
LEFT JOIN doctors 
ON testt.sec = doctors.id 
WHERE '2018-05-13' BETWEEN date_in AND date_out

D
Dmitry, 2018-05-14
@demon416nds

join

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question