mysql根据某一个字段去重

SELECT 
    qn.id,
    qn.quest_node_request,
    qn.father_node_id,
    qn.node_name,
    qn.node_code,
    qn.creater,
    qn. STATUS,
    qn.assigned_org,
    qn.main_creater_org
FROM
    quest_node qn
WHERE
    qn.enabled = 1
AND qn.father_node_id IS NULL
AND qn.main_creater_org = 2019181804
AND EXISTS(SELECT 1 from quest_node GROUP BY node_name HAVING MAX(id) = qn.id )

你可能感兴趣的:(mysql根据某一个字段去重)