I have two statements: one is written with mysql_query, another with PDO:
mysql_query:
$sql = $mysql_query("SELECT `user_report`.* FROM `user_report` LEFT JOIN `user` ON
`user_report`.`user_id` = `user`.`user_id` WHERE `user`.`userBlocked` = 0 GROUP BY
`user_id` ORDER BY `reports` DESC, `user_report`.`timestamp` ASC");
PDO prepared:
$sql = $pdo->prepare("SELECT `user_report`.* FROM `user_report` LEFT JOIN `user` ON
`user_report`.`user_id` = `user`.`user_id` WHERE `user`.`userBlocked` = 0 GROUP BY
`user_id` ORDER BY `reports` DESC, `user_report`.`timestamp` ASC");
$sql->execute();
PDO doesn't work with GROUP BY user_id
.
Reason I need it is if two results come with the same user_id
I want to show it as one.
How is it possible that PDO doesn't allow GROUP BY function ... in MySQL statement is there any substitute to that?
Thank you.