IBM MainFrame Question: Download IBM MainFrame PDF

select distinct(empid),distinct(dept),name
from EMP
will the above query work?

Tweet Share WhatsApp

Answer:

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

Download IBM MainFrame PDF Read All 28 IBM MainFrame Questions
Previous QuestionNext Question
We have an output dataset in job with disp parameter as SHR.
Can we write data in that file dataset?
How to handle -911 (deadlock) error in a db2 program so that the program will never abend?