How to select unique records from a table in SQL Server Database?
How to select unique records from a table in SQL Server Database?
66822-Sep-2021
Updated on 22-Sep-2021
Home / DeveloperSection / Forums / How to select unique records from a table in SQL Server Database?
Ashutosh Kumar Verma
24-Sep-2021Select Unique data from table-
This SQL statement used to retrieve unique(different) values. Sometimes a database table contains many duplicated value and if we want to retrieve all duplicated values in single from then we can use this SQL statement. It returns all different values from table.
Syntax –
SELECT DISTINCT column1,column2,column3,…. FROM table_name ;
Example:
Lets tale a table 'Orders'.
The following SQL statement is select the Unique values from OrderName column in Orders table.
Select Multiple column unique value from Orders table.
The following SQL statement is lists the number of different Id from Orders table-
This statement will returns the number of different column values from database table.
Ashutosh Kumar Verma
24-Sep-2021Select Unique data from table-
This SQL statement used to retrieve unique(different) values. Sometimes a database table contains many duplicated value and if we want to retrieve all duplicated values in single from then we can use this SQL statement. It returns all different values from table.
Syntax –
SELECT DISTINCT column1,column2,column3,…. FROM table_name ;
Ashutosh Kumar Verma
24-Sep-2021Select Unique data from table-
This SQL statement used to retrieve unique(different) values. Sometimes a database table contains many duplicated value and if we want to retrieve all duplicated values in single from then we can use this SQL statement. It returns all different values from table.
Syntax –
Ashutosh Kumar Verma
24-Sep-2021Select Unique data from table-
This SQL statement used to retrieve unique(different) values. Sometimes a database table contains many duplicated value and if we want to retrieve all duplicated values in single from then we can use this SQL statement. It returns all different values from table.
Syntax –
Example:
Lets tale a table 'Orders'.
The following SQL statement is select the Unique values from OrderName column in Orders table.
Select Multiple column unique value from Orders table.
The following SQL statement is lists the number of different Id from Orders table-
This statement will returns the number of different column values from database table.