-
-
Save kevinzen/663316 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT leads.id, | |
(SELECT COUNT(*) FROM searches WHERE lead_id = leads.id) AS searches_count, | |
(SELECT COUNT(*) FROM rental_searches WHERE lead_id = leads.id) AS rental_searches_count, | |
COALESCE((searches_count + rental_searches_count), 0) as total | |
FROM leads | |
WHERE leads.id = 35 | |
# Unknown column 'searches_count' in 'field list' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment