Revision 633861316565 () - Diff

Link to this snippet: https://friendpaste.com/4G2uZexRfhd3sSVROqjZEc
Embed:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
SELECT count(*)
FROM courses c
LEFT JOIN course_methodologies cm
ON cm.method_id = c.method_id
LEFT JOIN course_status cs
ON cs.status_id = c.status_id
LEFT JOIN partners p
ON p.user_id = c.user_id
LEFT JOIN events_schedule esched
ON c.course_id = esched.course_id
LEFT JOIN currency cur
ON cur.currency_id = c.currency_id
LEFT JOIN course_categories cc
ON cc.course_id = c.course_id
LEFT JOIN categories cat
ON cat.category_id = cc.category_id
LEFT JOIN program_types pt
ON pt.program_type_id = c.program_type_id
LEFT JOIN countries con
ON con.country_id = c.country_id
LEFT JOIN provinces ps
ON ps.province_id = c.province_id
LEFT JOIN states st
ON st.state_id = c.state_id
LEFT JOIN city cy
ON cy.city_id = c.city_id
LEFT JOIN partners_individual pi
ON pi.user_id = c.user_id
LEFT JOIN users u
ON u.user_id = c.user_id
WHERE 1 = 1 AND c.course_type = 1 AND active = 1 AND c.country_id = 52
AND ((('2010-10-01 00:00:00' <= esched.date_start
AND esched.date_start <= '2010-11-04 00:00:00')
OR ('2010-10-01 00:00:00' <= esched.date_end
AND esched.date_end <= '2010-11-04 00:00:00'))
OR ((esched.date_start <= '2010-10-01 00:00:00'
AND '2010-10-01 00:00:00' <= esched.date_end)
OR (esched.date_start <= '2011-10-04 00:00:00'
AND '2010-11-04 00:00:00' <= esched.date_end)))