Answer the question
In order to leave comments, you need to log in
How to make such a JOIN?
I don’t understand how to do it right JOIN
The first part works, in we get a selection sorted by "year month" and the number
We need to add almost the same thing from another table, but with the condition
WHERE eng_ur > 1and all this between dates
SELECT concat( EXTRACT(YEAR FROM ps_datetime ), ' ' , MONTHNAME(ps_datetime) ) AS MyDate,
COUNT(ps_id) AS x
FROM `patient_services` GROUP BY MyDate
JOIN(SELECT concat( EXTRACT(YEAR FROM eng_datetime ), ' ' , MONTHNAME(eng_datetime) ) AS MyDate,
COUNT(eng_id) AS x
FROM `engagements` GROUP BY MyDate )
WHERE eng_ur > 1 AND ( eng_datetime BETWEEN '$date_start' AND '$date_finish' )) WHERE ( ps_datetime BETWEEN '$date_start' AND '$date_finish' )
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question