lajkonik86 wrote:SELECT cc. * , ccomp.name, sum( p.prints ) AS regionprints FROM csite_coupons cc, csite_companies ccomp LEFT JOIN csite_popularity p ON ( p.couponid = cc.id AND p.day > 1190030380 ) WHERE cc.status =1 AND ccomp.status =1 AND cc.start < 1190110704 AND cc.end > 1190110704 AND cc.company = ccomp.id GROUP BY cc.id ORDER BY regionprints DESC LIMIT 0 , 10
gives error:
Unknown column 'cc.id' in 'on clause'
why?
To elaborate on what Lars wrote, this WAS a bug, in that older versions of MySQL accepted that syntax. the join clause fires first, then the rest of the tables are joined. So, the first table, cc, isn't seen yet.
I would strongly suggest you use join syntax for all your joins, as it's easier to read and simpler to troubleshoot and debug.
Also, indenting your queries will make them easier to troubleshoot as well, for both you and us.