mysql >查詢語句 * 查詢多條不重復記錄 id name 1 a 2 b 3 c 4 c 5 b select id, name from s1 group by name 1 a 2 b 3 c 5 b * 查詢重復記錄最多的記錄 SELECT keyword, count( * ) AS count FROM article_keyword GROUP BY keyword ORDER BY count DESC LIMIT 20 * 查詢重復記錄和重復次數 select user_name,count(*) as count from user_table group by user_name having count>1; * 多聯查詢 s1表 id name 3 a s2表 id s1_id age 1 2 12 2 3 23 SELECT * FROM `s2` WHERE `s1_id` = (SELECT id FROM `s1` WHERE `name` = 'a'); 結果 2 3 23