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 is query_cache_limit?

0 Answers  


I have 3 cursors declared. Cursor1 retieves some data. Based on this curso2 will also fetches some data. In cursor3 (using for some updation) I'm using the data retrieved by the above 2 cursor. My question is, while working with cursor3, periodically if I give commit, will all the three crsors will be closed or only cursor3 will be closed?

4 Answers  


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

2 Answers   CGI, UST, Xansa,


What is the syntax of SELECT statement when embedded in a COBOL program?

2 Answers  


Which catalog tables contain authorization information?

1 Answers  


Usually, which is more important for DB2 system performance - CPU processing or I/O access?

1 Answers  


How to find primary key of a table in db2?

0 Answers  


i have a table like this : Name ADDRESS Toto 123 ... Toto 456 ToTo 678 I would like to delete 2 last row...please tell me how to delete its

5 Answers   EDS,


What is buffrpool? Where we use it ?

2 Answers   Tesco,


How do you filter out the rows retrieved from a Db2 table ?

1 Answers  


What is the significance of DB2 free space and what parameters control it?

1 Answers  


Generally if I want to select the names starting with c I need to use c% But how could I code to select the data which contains % as a part of data.

5 Answers  


Categories