方式1:内层使用DISTINCT
SELECT
type,
senderName,
subTitle
FROM
(
SELECT DISTINCT
TYPE AS type,
SENDER_USERNAME AS senderName,
TARGET_NAME AS subTitle
FROM
`feed_message`
ORDER BY
CREATE_TIME DESC
) f
GROUP BY
type
方式2:添加limit
select id,user_name,user_sex,user_age from (
SELECT id,user_name,user_sex,user_age FROM `user_test`
order by user_age
limit 100
)A
group by A.user_sex