Jump to content


Photo

grouping arrays, sorting.


  • Please log in to reply
1 reply to this topic

#1 chewwy

chewwy
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 25 July 2006 - 12:48 PM

i'm not sure if this could be done in SQL itself, i don't think so, so i'll ask here.

right.  i have 6 columns of data in a MySQL table which i want to group all together, then sort alphabetically, while remembering what row of the table they belong to (i.e. there could be a 7th column, a number, and there'd be 6 pieces of data attahced to that number.  help the noob?

the alternative would be to have just 2 columns, with each number repeated 6 times.  then i could sort them easily in SQL, and not have to resort to PHP.  however i'm a little too far down the road to do that...

#2 king arthur

king arthur
  • Members
  • PipPipPip
  • Advanced Member
  • 335 posts
  • LocationUK HQ

Posted 25 July 2006 - 12:58 PM

So you want to get all the data, from all the columns and rows, and sort the whole lot alphabetically while remembering which row each bit of data came from? If that's the case I think I would look at building a temporary table and doing the sort on that, I don't know if that's the best solution.
Sir Isaac Newton said "If I have seen farther, it is by standing on the shoulders of giants". But it is not recorded as to whether he said it before or after he was hit on the head by a falling apple.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users