I have been asked to post a new question about how to correctly sort my data. Here is what I am trying to do. I want to make a single trip to my database for all of the data that I will need for this page. Once I have the data returned from the database, I need to sort it out and use it.
For brevity, I am only posting a single row of data. There are, in actuality, 8 rows being returned. Here is the structure of the data that is being returned:
col1 col2 col3 col4 col5 col6 col7 col8 col9
Now, here is the problem I am having. Columns 1 through 7 hold a 1:1 dataset. Columns 8 and 9 however, hold numerous rows, hence the 8 total rows. Because I have columns 1 through 7 mixed in with the 1:M rows, I am echoing rows 1-7 7 times more than I need to.
How can I resolve this?
Let me just add that there are 4 inner joins being used in this query. One of the tables, holds page specific data that I only need to access once. The other joins are what are creating the other rows. Let me just say tat the output of this resultset is absolutely correct. I just need to figure out how to sort it.
OK, this should make sense....
dealerId empId lotId rackId porterId vehicle vin
1 1 1 1 1 Geo 12JI997676JH
1 1 1 1 1 Ford 87HJ879854HS
1 1 1 1 1 BMW 567876HCS456
1 1 1 1 1 Mercedez 1JI8787GS687
In this set, notice that I have 4 rows of repeating data. What I need is this:
dealerId empId lotId rackId porterId
1 1 1 1 1
AND then for the multiple rows, I need this:
vehicle vin
Geo 12JI997676JH
Ford 87HJ879854HS
BMW 567876HCS456
Mercedez 1JI8787GS687
So, this setup now gives me the single row of my dealer data and I now have a new array with the vehicle data. :)