MsSql Simple Query method of all the data in the datasheet _mssql

Source: Internet
Author: User
Tags mssql

The example in this article describes the method for MSSQL to simply query all the data in the data table. Share to everyone for your reference, specific as follows:

The following examples are given directly here:

SELECT * from Sys_logcontent SLC
WHERE SLC. loginfo_id in
(
 SELECT slc2. loginfo_id from Sys_logcontent slc2 GROUP by SLC2. loginfo_id having COUNT (*) >1
)

Simple description:

The key code is in the parentheses above. To query for all duplicate data, you can follow a field to count all the records in the field that have a total of more than 1 duplicate data, which can be counted by using group by, and then the statistics are queried again as a query condition.

I hope this article will help you with your SQL Server database program.

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.