SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot zeeshan's Avatar
    Join Date
    Mar 2001
    Posts
    123
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi -

    I have a MySQL query that basically displays all songs in my database listed by album name in ascending order.

    However, I'd like my ouput to be displayed, FIRST by album name, and then NEXT by song name (within the same album).

    My query is:
    $query = "select C.SONGID, C.CATEGORYID, S.SONGNAME, S.SONGID, S.ALBUMNAME from
    SONGS S, SONGCATEGORY C where C.CATEGORYID=18 and S.SONGID=C.SONGID ORDER by S.ALBUMNAME ASC";

    Right now the output looks like:

    Album 1: Song 4
    Album 1: Song 1
    Album 1: Song 3
    Album 2: Song 2
    Album 2: Song 5
    ...

    And I'd like it t look like

    Album 1: Song 1
    Album 1: Song 2
    Album 1: Song 3
    Album 2: Song 1
    Album 2: Song 2
    Album 2: Song 3
    ... and so on

    Does anyone know how I can accomplish this - probably will ential changing the "ORDER BY" part in the query right?

    Any help would be appreciated. Thanks!

  2. #2
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Change

    ORDER by S.ALBUMNAME ASC

    to


    ORDER by S.ALBUMNAME ASC, S.SONGNAME
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  3. #3
    SitePoint Zealot zeeshan's Avatar
    Join Date
    Mar 2001
    Posts
    123
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You da Man!


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
  •