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

What are the various locking levels available?

3 Answers  


Which catalog table stores referential constraints?

1 Answers  


max number of columns in a db2 table?

6 Answers  


Who uses db2?

0 Answers  


we can code COPY DCLGEN or INCLUDE DCLGEN, At which stage of the precompilation , dclgen get expanded if we write 1) copy 2) include one question about dclgen.. Is it mandatory to use declare table in dclgen.. I think no...but it will be used by the precompiler to validate the table name,column name etc.., can one clear my doubt ..is it necessary to include declare table or not?

2 Answers  


how can you access index

4 Answers   IBM, Tech Mahindra,


What is DB2 (IBM Database 2)?

3 Answers  


What is the syntax required for the creation of a cursor?

1 Answers  


How could one combine a set of incremental image copies into a single copy?

1 Answers  


In BIND, isolation level parameter specifies the duration of page lock and ACQUIRE, RELEASE also do almost the same thing. What is the exact difference between the two? Do they work in conjunction while executing SQL queries and obtaining locks?

8 Answers   Syntel,


what is REORG? what is the use?

4 Answers  


Give some example of statistics collected during RUNSTATS?

1 Answers  


Categories