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


will the above query work?

Answer Posted / harsha

No, It will not work. SELECT DISTINCT works only for single
cloumn.

DISTINCT can be applied multiple times only when you want
to apply aggregate functions such as COUNT, AVG & SUM.
e.g.
SELECT COUNT(EMPNO)/COUNT(DISTINCT(WORKDEPT)), COUNT
(DISTINCT(JOB))
FROM DSN8810.EMP

Is This Answer Correct ?    14 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

is it compulsory commitment control in journal?

2018


Explain about mirror activator disk mirroring?

566


Explain about rct.

659


Explain in brief how does db2 determine what lock-size to use?

606


What's The Percentage Free Space ?

787






How to check table size in db2 sap?

592


How can you count the number of rows from a table tab?

647


What is the difference between drop table and delete table?

564


What is buffer pool?

627


Is it possible to alter a table – for example adding a column, when another user is accessing or updating some columns?

641


What is catalog database in db2?

655


What does db2 plan contain?

580


what is the sqlcode -501

11338


How do I create a view in db2?

616


How to rename a table in DB2 ?

647