select distinct(empid),distinct(dept),name
from EMP
will the above query work?
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / 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 |
What are the four lockable units for DB2?
What is the STOSPACE Utility used for?
What is the meaning of -805 SQL return code?
insert into tablename a column1, column2 select column1, column2 from tablename b i am getting abend -104..can any one help?
Define buffer pool.
How does DB2 store NULL physically?
What are iseries servers?
what is Static and dynamic linking
What is difference between alias and synonym in db2?
How to check sequence on a table in db2?
In db2, how do you insert multiple rows in 1 query using a.) Cursors, b.) Normal query?? Give syntax for both.
Explain transactions, commits and rollbacks in DB2.