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 is the use of bind parameter, Replace?
What is the difference between static and dynamic SQL?
In which column of which DB2 catalog would you find the length of the rows for all tables?
Q1. How will you use two different DB2 qualifiers in a single COBOL program? Suppose we have 2 tables EMP1 and EMP2 with same structure defined in two different DB2 qualifiers QUAL1.EMP1 and QUAL2.EMP2 now during first 15 days we want to use QUAL1.EMP1 and rest of the days QUAL2.EMP2 how will we do this. We can create a single program and a single load for this program.
How can you quickly find out the number of rows updated after an update statement?
What is the advantage in De-normalizing tables in DB2?
How do I change the column size in db2?
What is the use of with ur in db2?
What is db2?
Define db2.
How to select the duplicate rows from a table?
select * from orders where odate between '2010-01-01'and '2010-03-31' How do u fetch this into cursor?