select *,group_concat(p_name) as g from room left join rp on room.r_id = rp.r_id LEFT JOIN private_conf on rp.p_id=private_conf.p_id where(h_id='$id') GROUP BY (room.r_id) ;
mysql的执行顺序是
1.FROM
2.ON
3.JOIN
4.WHERE
5.GROUP BY
6.WITH CUBE or WITH ROLLUP
7.HAVING
8.SELECT
9.DISTINCT
10.ORDER BY
11.TOP
where 在groupby之前,having一般都是作为groupBy的过滤条件出现在groupby之后