mysql删除重复数据(通过多个字段分组,删除某一字段为空的数据)


DELETE FROM t_questions
WHERE Id in (
    SELECT Id FROM (
        SELECT Id FROM `t_questions`
            WHERE (Name,QuestionTypeId) 
                in (SELECT Name,QuestionTypeId FROM `t_questions` GROUP BY Name,QuestionTypeId HAVING Count(*) > 1)
                    AND Id 
                    NOT in (SELECT Id FROM `t_questions` WHERE Intention IS NOT NULL)
                                ) as a
)

 

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM