Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7430255
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T09:06:33+00:00 2026-05-29T09:06:33+00:00

can someone help me re-write this SQL for MySQL database (has both subquery and

  • 0

can someone help me re-write this SQL for MySQL database (has both subquery and outer join)

**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(+);**

I tried the following and it didnt work :

**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%'**
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T09:06:33+00:00Added an answer on May 29, 2026 at 9:06 am

    I have tried to rewrite the query, and this is what I have –

    SELECT
      REPORT_PACKAGE.SUBJECT_LINE,
      ACTIVATION_DT,
      PARAM_VALUE,
      REPORT_URL,
      hasCustomerDetails,
      isAccountsRolledUp
    FROM REPORT_PACKAGE
      JOIN REPORT_PARAMETER
        ON REPORT_PARAMETER.RPT_PACKAGE_ID = REPORT_PACKAGE.RPT_PACKAGE_ID
      JOIN REPORT_PACKAGE_CONTENT
        ON REPORT_PACKAGE_CONTENT.RPT_PACKAGE_ID = REPORT_PACKAGE.RPT_PACKAGE_ID
      JOIN REPORT_DEFINITION
        ON REPORT_DEFINITION.RPT_DEF_ID = REPORT_PACKAGE_CONTENT.RPT_DEF_ID
      LEFT JOIN (SELECT param_value hasCustomerDetails, rpt_package_id FROM report_parameter WHERE param_name = 'hasCustomerDetails') a
        ON a.RPT_PACKAGE_ID = REPORT_PACKAGE.RPT_PACKAGE_ID
      LEFT JOIN (SELECT param_value isAccountsRolledUp, rpt_package_id rid FROM report_parameter WHERE param_name = 'isAccountsRolledUp') b
        ON b.RPT_PACKAGE_ID = REPORT_PACKAGE.RPT_PACKAGE_ID
    WHERE
      param_name = 'rulePlanId'
      AND REPORT_URL like '%AcctNbr%'
    

    Add table aliases to make this query more readable.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can someone help me identify what the purpose of this unidentified syntax is. It
Can someone help me with this: This is a program to find all the
Can someone help me create an index/count button for a UITableView, like this one?
can someone help with this? I need the following function to do this... $x
Can someone help me on this. I'm made an image uploader and i want
Still wrapping my head around SQL and PHP, but hope someone can help with
This is bizarre, but I am hoping someone can help me out. I have
Can someone help me with this piece of code. In a loop I'm saving
Can someone help me write the dependency for javax.persistence . I have googled it
Can someone please help me write the following, without using dot notation: self.bounds.size.width I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.