How to select unique records by Sql server

Many times we think that how to get unique get unique data from table there are so many data so do not panic we can get very easy  or you save that we can get use only one line query we can get distinct (unique) records from sqlserver table. If you want to how to remove/delete unique data from the table in sql server

Syntax:-


SELECT DISTINCT columnname FROM tablename

Here we use DISTINCT keyword, Distinct Keyword always return distinct (unique) records.

Example:-
We have some data in below and here we will find unique contact number from the table
Table from Database


How to select unique records by Sql server


Query and out-put:-

How to select unique records by Sql server



Note: - You can also use count, where order by and so on operation with DISTINCT keyword, that you are using on select statement 

How to select unique records by Sql server How to select unique records by Sql server Reviewed by NEERAJ SRIVASTAVA on 2:10:00 PM Rating: 5

No comments:

Powered by Blogger.