select distinct(empid),distinct(dept),name
from EMP


will the above query work?

Answer Posted / chidambara subbu

No, It will not work. We can select DISTINCT values for
multiple columns however not all the columns will give
ditint value. For intance , see below table TABLE1
Name City
XXX Chennai
FFF HYD
XXX Blore
YYY Mumbai

1.SELECT DISTINCT NAME FROM TABLE1
Name
XXX
FFF
YYY
2. SELECT DISTINCT NAME,City FROM TABLE1
Name City
XXX Chennai
FFF HYD
XXX Blore
YYY Mumbai

See the result of second query. It has selected duplicate
entry 'XXX' in the Name column.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Which is faster delete or truncate?

684


What is consistency token in db2?

650


List out the buffer pools in db2

642


What is plan in cobol db2?

597


What is scrollable cursor in db2?

594






what is the role of the cursor in db2?

647


What is rebind in db2?

581


What is dclgen (declaration generator)?

609


What is difference between isnull and coalesce?

624


What is view db2?

633


What is runstats db2?

589


What is the difference between bind and rebind in db2?

866


What is a plan and package in db2?

634


Are views updateable?

649


What is dbrm in db2 database?

597