Может кто-нибудь помочь мне переписать этот SQL для базы данных MySQL (имеет подзапрос и внешнее объединение)
**select REPORT_PACKAGE.SUBJECT_LINE, ACTIVATION_DT, PARAM_VALUE, REPORT_URL, hasCustomerDetails,
isAccountsRolledUp FROM REPORT_PACKAGE, REPORT_PARAMETER, REPORT_DEFINITION, REPORT_PACKAGE_CONTENT,
(select param_value as hasCustomerDetails, rpt_package_id from report_parameter
where param_name = 'hasCustomerDetails') a,
(select param_value isAccountsRolledUp, rpt_package_id rid from report_parameter
where param_name = 'isAccountsRolledUp') as b
WHERE REPORT_PACKAGE.RPT_PACKAGE_ID = REPORT_PARAMETER.RPT_PACKAGE_ID
and param_name = 'rulePlanId' and
REPORT_PACKAGE_CONTENT.RPT_PACKAGE_ID = REPORT_PACKAGE.RPT_PACKAGE_ID and
REPORT_PACKAGE_CONTENT.RPT_DEF_ID = REPORT_DEFINITION.RPT_DEF_ID AND
REPORT_URL like '%AcctNbr%' and REPORT_PACKAGE.RPT_PACKAGE_ID = a.RPT_PACKAGE_ID(+)
and REPORT_PACKAGE.RPT_PACKAGE_ID = b.RPT_PACKAGE_ID(+);**
Я попробовал следующее, и это не сработало:
**select repa.SUBJECT_LINE, ACTIVATION_DT, PARAM_VALUE, REPORT_URL, hasCustomerDetails,
isAccountsRolledUp FROM REPORT_PACKAGE repa
left join (select param_value as hasCustomerDetails, rpt_package_id from report_parameter
where param_name = 'hasCustomerDetails') as a
left join (select param_value as isAccountsRolledUp, rpt_package_id from report_parameter
where param_name = 'isAccountsRolledUp') as b
left join a on repa.RPT_PACKAGE_ID = a.RPT_PACKAGE_ID
left join b on repa.RPT_PACKAGE_ID = b.RPT_PACKAGE_ID
inner join REPORT_PACKAGE_CONTENT repc on repa.RPT_PACKAGE_ID = repc.RPT_PACKAGE_ID
inner join REPORT_DEFINITION rd on repc.RPT_DEF_ID = rd.RPT_DEF_ID
where REPORT_URL like '%AcctNbr%'**