Can we use group-by clause in sub-query? If 'yes'
means,Will it be executed successfully or else If 'no'
means why should we not using that method? Give me your
suggestion please....



Can we use group-by clause in sub-query? If 'yes' means,Will it be executed successfully..

Answer / db2222

Yes, we can use the Group-by in the subquery.
-----EX----
SELECT DISTINCT(A.IDN), B.NAME,B.EFF_DATE, B.CNCRCY_TMSTMP
FROM
Table1 A,
Table2 B,
Table3 C
WHERE
A.IDN = C.IDN
AND C.IDN = B.ALIAS_IDN
AND A.IDN IN
(SELECT IDN
FROM Table4
GROUP BY CUSACC_IDN
HAVING COUNT(*) > 1
)
WITH UR;

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More DB2 Interview Questions

How to compare data between two tables in db2?

0 Answers  


What is the meaning of -805 SQL return code?

3 Answers  


what is check point and restart Logic ? why do we go for that ??

2 Answers   CGI, UST, Xansa,


what is a plan and how do you refer the plan in the program?

2 Answers   Xansa,


What is the role of the data page in the db2 database?

0 Answers  






What is the picture clause of null indicator variable?

0 Answers  


Explain about dbrm.

0 Answers  


what is the name of the default db2 catalog database?

3 Answers   IBM,


Explain correlated sub-queries.

0 Answers  


How to create db2 table in mainframe?

0 Answers  


i tried to copy some records from microsoft excel to as-400 physical file through "Bosanova" emulation. Out of 14000 records only 12000 records copies and subsequently programe started to hang. Then, i closed the program forcefully. I did' under stand the problem. Also when i try to compile the physical file it is showing as "The file in use". How to overcome this problem?

0 Answers   TATA,


Can there be more than one cursor open for any program?

0 Answers  


Categories