How to implement below query in RD
SELECT * FROM pegarules.pr4_rule_vw DRS where DRS.PYRULESET IN ('PegaCSFSM','PegaFSM',) AND DRS.pyRuleAvailable !='withdrawn' AND
(select COUNT(*) from pegarules.pr_index_reference IR INNER JOIN pegarules.pr4_rule_vw DR
ON
(DR.pxInsName=IR.pxReferencingInsName AND DR.pyClass=IR.pxInsIndexedClass AND DR.pyRuleSet=IR.pxReferencingRuleSetName
AND DR.pyRuleSetVersion=IR.pxReferencingRuleSetVersion AND IR.pyRuleName = DRS.pyRuleName AND IR.pxRuleObjClass=DRS.pyclass) where DR.pyRuleAvailable !='Withdrawn') = 0;
We are able to implement inner query
select COUNT(*) from pegarules.pr_index_reference IR INNER JOIN pegarules.pr4_rule_vw DR
ON
(DR.pxInsName=IR.pxReferencingInsName AND DR.pyClass=IR.pxInsIndexedClass AND DR.pyRuleSet=IR.pxReferencingRuleSetName
AND DR.pyRuleSetVersion=IR.pxReferencingRuleSetVersion AND IR.pyRuleName = DRS.pyRuleName AND IR.pxRuleObjClass=DRS.pyclass) where DR.pyRuleAvailable !='Withdrawn' easily in a single RD using inner join and COUNT function but how to implement the complete query