• 两种查询库中重复值的SQL


    SELECT *
    FROM   (
               SELECT *
                      ,RANK() OVER(ORDER BY who_answ) c2
               FROM   Ft_Question
           ) b
    WHERE  b.c2 IN (
                    SELECT a.c1
                    FROM   (
                               SELECT RANK() OVER(ORDER BY who_answ) AS c1
                               FROM   Ft_Question
                           ) a
                    GROUP BY c1
                    HAVING Count(c1) > 1)

    ----------------------
    SELECT     id, Tid, question, answer, who_quest, IP_quest, who_answ, state, time_quest, time_answer
    FROM         Ft_Question
    WHERE     (who_answ IN
                              (SELECT     who_answ
                                FROM          Ft_Question AS Ft_Question_1
                                GROUP BY who_answ
                                HAVING      (COUNT(*) > 1)))

    关于作者: 王昕(QQ:475660) 在广州工作生活30余年。十多年开发经验,在Java、即时通讯、NoSQL、BPM、大数据等领域较有经验。
    目前维护的开源产品:https://gitee.com/475660
  • 相关阅读:
    使用net start mysql的时候出现服务名无效的原因及解决办法
    Appium的安装
    cpu
    单例模式
    Java中Synchronized的用法(简单介绍)
    java随机数Reandom(简单介绍)
    多线程面试题
    线程和进程有什么区别(简单介绍)
    java多线程(简单介绍)
    servlet三种方式实现servlet接口
  • 原文地址:https://www.cnblogs.com/starcrm/p/1326350.html
Copyright © 2020-2023  润新知