chengxing85232321
Chauncy799
采纳率91.7%
2021-03-04 02:13

求 SQL多表查询,能查出重复值的语句

 

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

2条回答

  • hjue 多鱼的夏天 1月前

    SELECT A,count(A) as count FROM
    (SELECT A as A FROM table1
    UNION ALL
    SELECT B as A FROM table2
    UNION ALL
    SELECT C as A FROM table3)
    GROUP BY username HAVING count(A) >1;

    点赞 评论 复制链接分享
  • atjzw tule. 1月前


    select fieid from (
        select field, ROW_NUMBER () OVER (order by t1.field) row from (
            select field from table1
            union all
            select field from table2
            union all
            select field from table3
        ) t1
    ) t1 where t1.row > 1

    点赞 评论 复制链接分享