SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Wizard
    Join Date
    Mar 2008
    Location
    United Kingdom
    Posts
    1,285
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    ORDER BY issues :(

    Hi,

    I'm currently retrieving data in the following fashion:

    Code MySQL:
    SELECT ep.id, ep.title, ept.id, ept.name, ept.type FROM eproperty as ep, eproperty_type as ept WHERE ep.type = ept.id ORDER BY ept.id ASC

    My results look like this:
    id | title | id | name | type

    Now I'm ordering my results by 'type' ASC, but I'd like to then 'sub-order' by the first id.

    So it first orders them by type, then orders the results in that type, by id.

    Is this an SQL issue, or should I be looking to do this in my PHP?

  2. #2
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,510
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)
    ORDER BY ept.id ASC, ep.id

  3. #3
    SitePoint Wizard
    Join Date
    Mar 2008
    Location
    United Kingdom
    Posts
    1,285
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Wow, brilliant. Just like that


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •