SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Wizard Mincer's Avatar
    Join Date
    Mar 2001
    Location
    London | UK
    Posts
    1,140
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help with MySQL query...

    Code:
    $sql = "
    	SELECT unbilled_item.job_number,unbilled_item.week_ending,unbilled_item.amount,job.client,job.project
    	FROM unbilled_item 
    	LEFT JOIN job ON (unbilled_item.job_number=job.job_number) WHERE job.project_manager = \"24965\"
    	" ;
    Is it possible to do a (how do I put this..) 'double ORDER BY' ??

    Ie. Order first by job_number and then order each line from that by week_ending ??

    (week_ending is a standard DATE field)

    Thanks.

  2. #2
    SitePoint Evangelist CyberFuture's Avatar
    Join Date
    May 2001
    Location
    San Diego, CA
    Posts
    434
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try this:
    PHP Code:
    $sql "
        SELECT unbilled_item.job_number,unbilled_item.week_ending,unbilled_item.amount,job.client,job.project
        FROM unbilled_item 
        LEFT JOIN job ON (unbilled_item.job_number=job.job_number) WHERE job.project_manager = \"24965\"
    ORDER BY unbilled_item.job_number, unbilled_item.week_ending

        " 

    You can add DESC after either option to reverse the sort order.


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
  •