SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Nov 2000
    Location
    Sydney, Australia
    Posts
    65
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello there,

    I have a question in regards to mySQL is it possible to order a group of articles within another group of ordered articles?

    For example.. say I have a catalogue of items, and each has the properties of date, and item_name.

    in this mySQL database, for arguments sake, i have

    id date item_name
    1. 2001-4-5 Toothpaste
    2. 2001-2-15 Soap
    3. 2001-4-5 Hairbrush
    4. 2001-2-15 Shaving Cream

    What I would like to do, is to SELECT all the items from this database, and ORDER BY date in DESCending order, and then ORDER BY item_name, so I will end up with

    3. 2001-4-5 Hairbrush
    1. 2001-4-5 Toothpaste
    4. 2001-2-15 Shaving Cream
    2. 2001-2-15 Hairbrush

    Is there a mySQL statement that can do that for me? Or would I have to go through each date then systematically grab each group of items according to the date.

    Thanks for any help!
    Ardi
    http://www.myringtones.net (down again) - Free Ringtones for your Nokia and Ericsson GSM phone : brought to you by The Ringtone Factory

  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)
    SELECT * from tablename ORDER BY date DESC, item_name;
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  3. #3
    SitePoint Enthusiast
    Join Date
    Nov 2000
    Location
    Sydney, Australia
    Posts
    65
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Excellent! Thanks.. I had something like that, but i had put the item_name before the DESC
    http://www.myringtones.net (down again) - Free Ringtones for your Nokia and Ericsson GSM phone : brought to you by The Ringtone Factory


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
  •