You can translate the question and the replies:

Can someone help me how to implement the below logic that uses sub query?

SELECT DISTINCT pd.PROJECT_ID, vuc.ID, vuc.NAME, vuc.PARENT_ID, ( SELECT DISTINCT CASE WHEN vuc.NODE_LEVEL=2 THEN 'null' WHEN vuc.NODE_LEVEL=3 THEN vuc.NAME WHEN vuc.NODE_LEVEL=4 THEN (select mo.name from unit_code mo where mo.id= vuc.PARENT_ID) END FROM unit_code MO ) AS MANAGING_ORGANISATION, vuc.NODE_LEVEL, ( select dvc.name from unit_code dvc where dvc.id in (select mdvc.parent_id from unit_code mdvc where mdvc.id= vuc.PARENT_ID AND vuc.NODE_LEVEL=4) OR dvc.id= vuc.PARENT_ID and vuc.NODE_LEVEL=3 OR dvc.id= vuc.ID and vuc.NODE_LEVEL=2 ) AS PORTFOLIO_OWNER FROM portfolio p, portfolio_member pm, unit_code vuc, deliverable pd WHERE p.PORTFOLIO_TYPE = 'Vested Unit' AND p.PORTFOLIO_ID = pm.portfolio_id AND p.PORTFOLIO_TYPENAME_ID = vuc.ID AND pm.MEMBER_TYPE = 'SMAP' AND pd.DELIVERABLE_ID = pm.MEMBER_KEY ORDER BY pd.PROJECT_ID
user
01-06-2021 05:13:28 -0400

1 Answer

Hi, subqueries cannot be included in the SELECT clause (as mentioned in the case below). [Subqueries cannot be included in a SELECT clause](https://community.denodo.com/answers/question/details?questionId=90670000000Xd01AAC&title=Subqueries+cannot+be+included+in+a+SELECT+clause) If you need more help and have a valid support account, you can open a new case in the Support Site so Denodo team can help you. Hope this helps!
Denodo Team
03-06-2021 05:20:15 -0400
You must sign in to add an answer. If you do not have an account, you can register here