Jump to content

SQL Hell: split field, group by, transpose.


islingtonclaret

Recommended Posts

Going through database hell, if any of the Villatalk developers fancy throwing a few ideas around.

 

I need a dataset for an Analytics package - the package can execute Oracle PL/SQL, talking directly to the Oracle database through JDBC.

 

The dataset has to be exactly correct - by that, I mean what the analytics package expects as the correct form of dataset to build a chart from.

 

Data looks like this:

 

RequestID         RequestDate       TypeofData

21315115         01/03/2015          001,010,011,002,005

21345477         04/03/2015          001,006,014

 

What is needed out of this requires a monster amount of processing, with no temp tables, no procedures - just pure SELECT goodness.

 

By using WITH x AS nesting, the latter parts of the processing are fine, it's just the beginning bit.

 

TypeofData needs to be split, with new rows per comma seperated value. So, we get this:

 

RequestID     RequestDate     TypeofData

21315115      01/03/2015       001

21315115      01/03/2015       010

21315115      01/03/2015       011

21315115      01/03/2015       002

21315115      01/03/2015       005

21345477      04/03/2015       001

21345477      04/03/2015       006

21345477      04/03/2015       014

 

I won't bore anyone with the transposing and month grouping, as that's pretty much in hand.

Just to pre-empt anyone: I have no access to this database to write functions, procedures, create new tables....the only thing I have to manipulate the data is JavaScript functions, and that happens only after the fetch.

 

Long, boring post, apologies. ANY pointers would be awesome....

Link to comment
Share on other sites

I think I've got what I'm going to do.

 

I'm going to create my own middleware to capture the records, get PHP to chuck it all into arrays and explode them then throw them in a PostgreSQL db. I figured if there's no middleware, I might as well force it myself!

Link to comment
Share on other sites

×
×
  • Create New...
Â