Sunday, January 9, 2011

Use of distinct in sql server


the word distinct is make the information of the field in the group.
we can understand it easily to se the example if the distinct.

syntex:-
select distinct <field name> from table name;

example:-

suppose there is data of database named "dept" as follow

     dept salary

salary 10,000
sales 11,000
salary 5,000
sales 7,000

select distinct dept,salary from dept;

output is:-

dept_name     salary

salary       15,000

sales       18,000

No comments:

Post a Comment