Query formation

Hi,

1. main query.sql file attached

2. mainquery result set is attached

3. Required format of the result set attached in the excel "TO BE RESULT SET.XLS.xlsx"

Please help to achive this format.

Thanks
Main-query.sql
mainquery-result-set.xlsx
TO-BE-RESULT-SET.XLS.xlsx
Aravindan GPAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

awking00Information Technology SpecialistCommented:
Because they appear to be left_justified, may we assume that date_only, sector, month, and month_nr as of character datatype?
0
awking00Information Technology SpecialistCommented:
cmpgn_yr as well?
0
awking00Information Technology SpecialistCommented:
What version of Oracle are you using?
0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

awking00Information Technology SpecialistCommented:
Try this
select rtrim(xmlagg(xmlelement(e,date_only||',')).extract('//text()'),',') date_only
      ,rtrim(xmlagg(xmlelement(e,res_cell||',')).extract('//text()'),',') res_cell
      ,sector
      ,region
      ,month
      ,month_nr
      ,cmpgn_yr
      ,division
from (<your main query>)
group by sector, region, month, month_nr, cmpgn_yr, division;
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Aravindan GPAuthor Commented:
Hi,

Sorry for the delayed reply.

My oracle version is 10g.

Regards
0
awking00Information Technology SpecialistCommented:
Then my last response should work.
0
Aravindan GPAuthor Commented:
Please check the attachd images.
The order of date_only is not matching with order of res_cell..

Please help resolve, this is the same problem I am facing when using wm_concat as well.
results-obtained.JPG
Required-result-order.JPG
0
Aravindan GPAuthor Commented:
Thank you
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.