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 will you return the number of records in table?

1 Answers  


What is view db2?

1 Answers  


Can we update view in db2?

1 Answers  


select * from orders where odate between '2010-01-01'and '2010-03-31' How do u fetch this into cursor?

2 Answers  


Which one allows duplicate values Union or Union All ?

3 Answers  


How does coalesce work?

1 Answers  


What is a synonym? How is it used?

2 Answers  


What technique is used to retrieve data from more than one table in a single SQL statement?

9 Answers   CTS, IBM, TCS,


Is it possible to precompile if db2 goes down?

4 Answers   Target,


What is a Database Request Module(DBRM)?

4 Answers  


5 rows are inserted to a DB2 Table. Next 3 of those are updated, then a rollback is issued. What would happen when the rollback is issued?

2 Answers  


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....

1 Answers  


Categories