1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Conditional ORDER BY

Discussion in 'MySQL' started by lektrikpuke, May 31, 2015.

  1. #1
    select blah, blah, blah
    order by
    fldRecur
    , case fldRecur
    when 1 then fld_order_timestamp
    when 0 then fldCreateTimeStamp
    end;

    The above works, however what I really want is fld_order_timestamp desc and fldCreateTimeStamp asc. I cannot seem to make that part work. Help?
     
    lektrikpuke, May 31, 2015 IP
  2. lektrikpuke

    lektrikpuke Well-Known Member

    Messages:
    297
    Likes Received:
    1
    Best Answers:
    1
    Trophy Points:
    113
    #2
    got it!

    order by
    fldRecur
    , case fldRecur when 1 then fld_order_timestamp end desc
    , case fldRecur when 0 then fldCreateTimeStamp end asc
     
    lektrikpuke, Jun 1, 2015 IP