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

Can a unique index have more than one null value? If not, what error code is given if an attempt is made to insert more than one null value?

3 Answers  


How connect db2 database to datastage?

0 Answers  


What is a db2 cursor?

0 Answers  


Why select is not preferred in embedded sql programs?

0 Answers  


Suppose we have a query for update update table1 set col1 = 'val1' where col2=(select .... from ...) suppose the subquery does not return any record, what will happen to update?

1 Answers   IBM,






What is the difference between TYPE 1 index & TYPE 2 index

1 Answers   IBM,


What is difference between rollback and commit?

0 Answers  


What is a Resource Control Table(RCT)? Describe its characteristics.

3 Answers  


SQLCODE = -199, ERROR: ILLEGAL USE OF KEYWORD CHAR, TOKEN KEY was expected

0 Answers  


What is DYNSLT keyword? How do you perform selection using DYNSLT

1 Answers  


what is commit & rollback? When and where is used while compiling a cobol-db2 program?

2 Answers  


How to view db2 table structure?

0 Answers  


Categories