I am making a polling script, I have it able to get the top 3 items voted for. I am trying to left join the item data with the result data with this query
Code:
SELECT `votes.poll_id` AS `votes_pollid`,
COUNT(`item_id`) AS `count`,
`item_id`,
`items.*`
FROM `votes`
LEFT JOIN `items` ON `votes.id`=`items.poll_id`
WHERE `votes.poll_id` = '1'
GROUP BY `item_id`
ORDER BY `count` DESC
LIMIT 3;
It tels me that votes.poll_id doesn't exist. That is simply not true, I can call votes.poll_id in a separate query and it comes up.