Solved

Show results in columns vs rows

Posted on 2016-09-01
5
53 Views
Last Modified: 2016-09-01
I need to have my results displayed in as many columns as the results need (the number of columns will vary depending on the record) instead of the rows the results are currently being written to.

Here's a sample resultset as it is dumped into rows:
ID          lname          fname          response          current
100       Doe               John             Mickey              Donald
100       Doe               John             Mickey              Tweety
100       Doe               John             Mickey              Daffy
100       Doe               John             Minnie              Pluto
100       Doe               John             Daffy                 Pluto

Here's what I need it to be:
ID       lname    fname    response1    response 2    current1   current2    current3
100    Doe         John      Mickey                                   Donald      Tweety      Daffy
100    Doe         John      Minnie           Daffy              Pluto

Or it can be like this:  (This way would be awesome!)
ID      lname      fname    response1   current1   response2    current2
100   Doe          John        Mickey         Donald     Minnie           Pluto
                                                                Tweety                             Daffy
                                                                Daffy                        

To complicate matters, the database this is being written against is Intersystems' Caché, which is FAR from SQL Server unfortunately, so I can't do temp tables, stored procs or other normal database stuff.
0
Comment
Question by:fcsIT
  • 3
  • 2
5 Comments
 
LVL 39

Expert Comment

by:lcohan
ID: 41780445
Please see the basics from link below hopefully it will help to achieve the "pivot" function that you need as it looks like it supports SQL code :

http://www.artfulsoftware.com/infotree/qrytip.php?id=78

Worst case if none of us here can help I see "David E. Nelson" has some training session on "Creating DeepSee Models, Pivot Tables, Dashboards, and KPIs"
1
 

Author Comment

by:fcsIT
ID: 41780465
Thank you Icohan, but unfortunately Intersystems' Caché doesn't support pivot.
0
 
LVL 39

Accepted Solution

by:
lcohan earned 500 total points
ID: 41780516
Well I'm not expert for sure in Intersystems' Caché database coding/admin however according to this link http://www.intersystems.com/uk/library/library-item/introduction-to-deepsee-and-iknow-for-intersystems-campus/ there there is some training session on Pivot table right?

And what about this? it looks to me you can use DeepSee to do just that - Pivot right? is a BI tol provided by

http://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=D2GS_ch_intro
http://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=D2DT_ch_pivotetc

Besides that, In MySQL the "pivot" it's a two-step:

1. In an inner query, write one aggregating expression per reporting column,
2. In an outer query, build the horizontal sums:

and as Intersystems' Caché  supports SQL...that should do it right?
0
 

Author Comment

by:fcsIT
ID: 41780624
Well, what complicates this more is we inherited Caché when it came with a vended product.  That vendor doesn't allow us to do pretty much anything with Caché.  The vendor has blocked the areas in the System Management Portal that enable DeepSee.

Looks like I'm probably up the creek on this.  Sounds like I need to start building macros into a spreadsheet that can manipulate the data in its current form to make it what I need.

Gotta love these situations...

Thank you Icohan.  I appreciate your diligent help.
0
 
LVL 39

Expert Comment

by:lcohan
ID: 41780640
"Sounds like I need to start building macros into a spreadsheet that can manipulate the data in its current form to make it what I need."
Can't you bring it in mySQL instead or any other database - even SQL Express if is not > 2GB and do it there instead? Maybe that's easier than Excel.

Also, "hat vendor doesn't allow us to do pretty much anything with Caché. The vendor has blocked the areas in the System Management Portal that enable DeepSee." - I would check if is not to dificult to see if this was done on purpose due to some licensing because if it does not require additional money then..you get the idea - is your right to use the product you paid for to FULL extent instead of bending backwards to reinvent something thats built in.
If is money related see maybe you can build a case to get it "unlocked" and utilized elsewhere as BI...must be useful to someone over there if they have the money to buy such product.


Good luck!
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
Many companies are looking to get out of the datacenter business and to services like Microsoft Azure to provide Infrastructure as a Service (IaaS) solutions for legacy client server workloads, rather than continuing to make capital investments in h…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now