Sqlserver the values of both columns in a table are the same.

Source: Internet
Author: User
Welcome to the Windows community forum, and interact with 3 million technical staff to enter the business needs of today. If no final information is found on the internet, leave A print for reference # Table A in Table T1, SELECT * FROM # T1t1WHERE (SELECTCOUNT (*) FROM (SELECTDISTINCTA, BFROM # T1WHEREAt

Welcome to the Windows community forum, and interact with 3 million technical staff> enter the business needs today. If you cannot find the final output on the internet, leave A print for reference # Table A in Table T1, SELECT * FROM # T1 t1 WHERE (select count (*) FROM (select distinct a, B FROM # T1 WHERE A = t

Welcome to the Windows community forum and interact with 3 million technicians>

Today's business needs. If you don't find the final output on the internet, leave a print for reference.

# At least three rows in column A and column B in Table T1 share the same data

SELECT * FROM # T1 t1 WHERE

(

Select count (*) FROM (

Select distinct a, B FROM # T1 WHERE A = t1.A

)

) = 1

AND (select distinct count (ID) FROM # T1 where a = t1.A)> = 3

Order by t1.A

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.