I need to run a select within a select, but encounter an unexpected token error. Below is a very simplified version of the SQL statement. The actual statment has many joins to other tables and I cannot join to the comment table as it multiplies the rows excessively. I suppose I could do a group by, but this syntax works in other databases, so I don't understand why it is failing in DB2?
Here is the SQL:
I'm fairly new to db2 syntax and would really appreciate any help. Thanks ;-)
Joel
Here is the SQL:
Code:
SELECT PROPOSAL.PROPOSAL_ID,
(SELECT Count(c.PROPOSAL_ID) FROM PRED."COMMENT" c WHERE c.PROPOSAL_ID=PROPOSAL.PROPOSAL_ID) AS CountComments
FROM PRED.PROPOSAL PROPOSAL
Joel