SELECT count(`tieba_info`.*) as `total`,`tieba_cat`.`id` as `id` , `tieba_cat`.`name` as `name` ,`tieba_cat`.`desc`
FROM `tieba_cat`
left join `tieba_info` on `tieba_cat`.`id`=`tieba_info`.`cat_id`
ORDER BY `tieba_info`.`total` DESC
LIMIT 0 , 2000 这个语句怎么是错误的啊?
如何解决?
FROM `tieba_cat`
left join `tieba_info` on `tieba_cat`.`id`=`tieba_info`.`cat_id`
ORDER BY `tieba_info`.`total` DESC
LIMIT 0 , 2000 这个语句怎么是错误的啊?
如何解决?
#1064 - 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 '*) as `total`,`tieba_cat`.`id` as `id` , `tieba_cat`.`name` as `name` ,`tieba_ca' at line 1
FROM `tieba_cat`
left join `tieba_info` on `tieba_cat`.`id`=`tieba_info`.`cat_id`
ORDER BY `count(`tieba_info`.*) DESC
LIMIT 0 , 2000
后来好了,是因为需要GROUP BY这个语句,才可以的。