table: id tag status 1 a 0 2 b 0 3 c 1 4 d 1 一、group by用法 1.與count 聯合計數 select status,count(*) from table group by status
status count(*)
0 2
1 2 2.與 group_concat聯合使用 select status,group_concat(tag) as tag from table group by status
status tag
0 a,b
1 c,d

二、limit用法 1.分頁 設頁數為page ,每頁記錄為a select * from table limit (page-1)*a