Reformatting data
Hi There
I have a nasty piece of SQL which queries 4 tables using Left & right joins, this is because each record may have many different categories associated with it and so a record is returned for each different category found ie : -
recid1 somemoredata category a
recid1 somemoredata category b
recid1 somemoredata category c
recid2 record2data category 1
recid2 record2data category 2
As you can see the net result of which is a recordset containing a lot of redundant data. Now I needed this reformatted similarly to output from the ado getrows method, ie Columns/Rows so that the categories were appended onto the end of one record so that the above example would be rendered as
recid1 somemoredata category acategory bcategory c
recid2 record2data category 1category 2
I did this but think my method was pretty inefficent, I did mine by using the dictionary object and a new array. If anyone is remotely interested I can post the code. I also worked out another way by just transferring data directly from the original array to a new 2-way array.
I also thought data shaping might cut down on the redundant data aspect, anyway all other thoughts are welcome.
|