Knowledge Walls
Gopal Rao
Mumbai, Maharashtra, India
Passcode:
Distinct in sql server example in Queries of SQL Queries
2712 Views
Syntax
select distinct columnName from tableName where columnName='value';
Example
Find the employee numbers of all employees who are clerks or work for department d3.

select distinct w.emp_no,e.emp_no from Works_on as w inner join Empolyee as e on e.dept_no='d3' or w.Job='Clerk';
Hints 
Distinct used to return different values only from the column.If repeated values present in column if you use distinct keyword it will omit those values.
  Copyright © 2014 Knowledge walls, All rights reserved
KnowledgeWalls
keep your tutorials and learnings with KnowledgeWalls. Don't lose your learnings hereafter. Save and revise it whenever required.
Click here for more details