Database sort the sort again

Posted on 2011-10-04
Last Modified: 2012-06-21
i was wondering if i can sort then sort again in a 1 line Mysql query?

eg. if i have TABLEXX

Project Name    Product Name
Project a          product 1
Project b          product 4
Project a          product 8
Project a          product 6
Project b          product 3

I sort first by Project Name so i get the output

Project a          product 1
Project a          product 8
Project a          product 6
Project b          product 3
Project b          product 4

but then i sort by Product so i should get

Project a          product 1
Project a          product 6
Project a          product 8
Project b          product 3
Project b          product 4

Any help would be great.Cheers.
Question by:chiboy888
    LVL 39

    Accepted Solution

    try this

    select Project_Name ,    Product_Name from TABLEXX
    order by  Project_Name ,    Product_Name

    Author Comment

    thanks pratima,
    i think that did the trick

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    SQL Command Tool comes with APEX under SQL Workshop. It helps us to make changes on the database directly using a graphical user interface. This helps us writing any SQL/ PLSQL queries and execute it on the database and we can create any database ob…
    Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
    Video by: Steve
    Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now