SELECT
ul.id,
ul.device_type,
ul.device_token,
COUNT(cl.lead_id) AS total_leads
FROM
custom_leads AS cl
LEFT JOIN
user_login AS ul ON ul.id = cl.lead_cre_user_id
WHERE
cl.lead_from = 'dealer-app' AND ul.user_type = '21' AND ul.user_category = 'Dealer' AND ul.sub_type = 'Org'
GROUP BY
cl.lead_cre_user_id
HAVING
total_leads >= 10 AND total_leads <= 35
ul.id,
ul.device_type,
ul.device_token,
COUNT(cl.lead_id) AS total_leads
FROM
custom_leads AS cl
LEFT JOIN
user_login AS ul ON ul.id = cl.lead_cre_user_id
WHERE
cl.lead_from = 'dealer-app' AND ul.user_type = '21' AND ul.user_category = 'Dealer' AND ul.sub_type = 'Org'
GROUP BY
cl.lead_cre_user_id
HAVING
total_leads >= 10 AND total_leads <= 35
No comments:
Post a Comment