Home > Database > Mysql Tutorial > sqlserver 一张表两列都的值都相同处理

sqlserver 一张表两列都的值都相同处理

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-07 15:46:09
Original
1476 people have browsed it

欢迎进入Windows社区论坛,与300万技术人员互动交流 >>进入 今天业务需要,网上没找到 最后写出来了就留个印以备查阅 #T1表中 A,B 列 至少三行都相同的数据 SELECT * FROM #T1 t1 WHERE ( SELECT COUNT(*) FROM( SELECT DISTINCT A,B FROM #T1 WHERE A=t

欢迎进入Windows社区论坛,与300万技术人员互动交流 >>进入

  今天业务需要,网上没找到  最后写出来了就留个印以备查阅

  #T1表中 A,B 列 至少三行都相同的数据

  SELECT * FROM #T1 t1 WHERE

  (

  SELECT COUNT(*) FROM(

  SELECT DISTINCT A,B FROM #T1 WHERE A=t1.A

  ) A

  )=1

  AND (SELECT DISTINCT COUNT(ID) FROM #T1 WHERE A=t1.A)>=3

  ORDER BY t1.A

sqlserver 一张表两列都的值都相同处理

Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
Problem with tp6 connecting to sqlserver database
From 1970-01-01 08:00:00
0
0
0
Unable to connect to SQL Server in Laravel
From 1970-01-01 08:00:00
0
0
0
Methods of parsing MYD, MYI, and FRM files
From 1970-01-01 08:00:00
0
0
0
SQLSTATE: User login failed
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template