[eluser]Oblique[/eluser]
At the same time, i encountered some strange behaviour
On my dev WAMP this worked fine (MYSQL ver. = 5.0.45 if it matters somehow):
but in production LAMP (MYSQL ver. = 5.0.89) it made this crap:
Quote:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '`users_subquery`.id = `users`.`id`) AS created_freightage_count FROM (`users`) L' at line 4
Code:
SELECT `users`.`id`, `users`.`username`, `users`.`email`, `users`.`permissions`,
`users`.`created`, `users`.`activated`, `users`.`role`, `user_profiles`.`id` AS profile_id,
`user_profiles`.`company_name` AS profile_company_name,
(SELECT COUNT(*) AS count
FROM (`freightages`) LEFT OUTER JOIN `users`
as creator_users ON `creator_users`.`id` = `freightages`.`creator_id`
//why `` here??
WHERE creator_`users_subquery`.id = `users`.`id`)
AS created_freightage_count
FROM (`users`) LEFT OUTER JOIN `user_profiles` as user_profiles
ON `users`.`id` = `user_profiles`.`user_id`
WHERE `users`.`role` = 'carrier'
AND `users`.`activated` = '1'
LIMIT 10