Answer the question
In order to leave comments, you need to log in
SQL. How to request data between two dates in such a case?
Good afternoon.
There is a query with LEFT OUTER JOIN
SELECT u.event_id, u.event_name, u.start_date, u.end_date, u.serv_id, d.name, c.client_nm as cli FROM tevents u LEFT OUTER JOIN doctors d ON u.`type` = d.id LEFT OUTER JOIN clients c ON u.`combo_select` = c.id
WHERE u.start_date between "2018-05-23 08:50:00" and "2018-05-23 08:50:00"
Answer the question
In order to leave comments, you need to log in
So you have a tevents table with an alias u always returned in full, so just add your condition code to the query, it doesn’t matter which join is left or inner in this case.
SELECT u.event_id,
u.event_name,
u.start_date,
u.end_date,
u.serv_id,
d.name,
c.client_nm as cli
FROM tevents u
LEFT OUTER JOIN doctors d
ON d.id = u.type
LEFT OUTER JOIN clients c
ON c.id = u.combo_select
WHERE u.start_date between '2018.05.23 06:00:00' and '2018.05.23 21:50:00'
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question