Thursday, January 23, 2014

GET UNIQUE VALUES WITHOUT USING DISTINCT


GET UNIQUE VALUES WITHOUT USING DISTINCT
In TSQL Statement you can get unique rows without using distinct
employee
employee_name
employee_Designation
Joe
S.E
Sunil
SSE
Alex
SE
Albert
TL
Jack
AM
Alex
AM
We want no unique designation from employee table.
SELECT employee_Designation from employee
GROUP BY employee_Designation
Running this query will return the following results:
employee_location
SE
SSE
TL
AM
This is a valid alternative to using the DISTINCT keyword
 

No comments:

Post a Comment