Thread: Ordering

    #1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2004
    Posts
    56
    Rep Power
    11

    Ordering


    I have these values stored in a db table:

    6x 1TB NL SAS 7.2K (4+2 RAID 6)
    6x 2TB NL SAS 7.2K (4+2 RAID 6)
    6x 300GB SAS 15K (4+1 RAID 5 + Hotspare)
    6x 3TB NL SAS 7.2K (4+2 RAID 6)
    6x 600GB SAS 10K (4+1 RAID 5 + Hotspare)
    6x 900GB SAS 10K (4+1 RAID 5 + Hotspare)
    8x 300GB SAS 15K (6+1 RAID 5 + Hotspare)
    8x 600GB SAS 15K (6+1 RAID 5 + Hotspare)
    8x 900GB SAS 10K (6+1 RAID 5 + Hotspare)

    And this is the order they return if I query with 'ORDER BY CalculatorDataVnxeAliases.friendly_alias ASC'. The problem is that I need 3TB before 300GB like this:

    6x 1TB NL SAS 7.2K (4+2 RAID 6)
    6x 2TB NL SAS 7.2K (4+2 RAID 6)
    6x 3TB NL SAS 7.2K (4+2 RAID 6)
    6x 300GB SAS 15K (4+1 RAID 5 + Hotspare)
    6x 600GB SAS 10K (4+1 RAID 5 + Hotspare)
    6x 900GB SAS 10K (4+1 RAID 5 + Hotspare)
    8x 300GB SAS 15K (6+1 RAID 5 + Hotspare)
    8x 600GB SAS 15K (6+1 RAID 5 + Hotspare)
    8x 900GB SAS 10K (6+1 RAID 5 + Hotspare)

    I have tried several methods but nothing seems to work. Any ideas?
  2. #2
  3. Code Monkey V. 0.9
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Mar 2005
    Location
    A Land Down Under
    Posts
    2,111
    Rep Power
    1990
    I highly doubt that there's any built-in ordering method that will work with custom parameters like that. If it was me, I'd add another column to the table for sort_order and use that for the ordering. That way you can set the ordering to be whatever you want it to be. You can also sort by sort_order ASC, Friendly_alias ASC. It makes life a whole lot easier.

IMN logo majestic logo threadwatch logo seochat tools logo