| List: | General Discussion | « Previous MessageNext Message » | |
| From: | Richard | Date: | April 8 2008 11:04am |
| Subject: | Help with ORDER BY using two colomns | ||
| View as plain text | |||
Hello, I've got a table which containes two date colomns. The first one is called `date` and the second `update` In the first one I put the ticket creation date, and on update I add or change the update value. So the update colomn does not contain a value until the first update has been done. I would like to order the tickets by their last update value. And if this value does not exist use the date value. at the moment I use this : ORDER BY `date` DESC" and I would like to replace it by something like this : ORDER (IF `update`!= '' BY UPDATE ELSE BY DATE) I know this code is completly wrong, just to try and show you what I need ... Here is an example of what I want to achieve num | date | update ------------------------------------------- 1 | 1 | 2 | 10 | 60 3 | 20 | 4 | 30 | 5 | 40 | 90 6 | 50 | The required result would be : num | date | update ------------------------------------------- 5 | 40 | 90 2 | 10 | 60 6 | 50 | 4 | 30 | 3 | 20 | 1 | 1 | Thanks in advance :)
| Thread | ||
|---|---|---|
| • Help with ORDER BY using two colomns | Richard | 8 Apr |
| • Re: Help with ORDER BY using two colomns | Kristian Myllymäki | 8 Apr |
| • Re: Help with ORDER BY using two colomns | Richard | 8 Apr |
| • Re: Help with ORDER BY using two colomns | Rafael Barbolo Lopes | 8 Apr |
| • Re: Help with ORDER BY using two colomns | Richard | 8 Apr |
| • Re: Help with ORDER BY using two colomns | Ben Clewett | 8 Apr |
| • Re: Help with ORDER BY using two colomns [ solved thankyou :) ] | Richard | 8 Apr |
| • Re: Help with ORDER BY using two colomns [ solved thankyou :) ] | Ben Clewett | 8 Apr |
| • Re: Help with ORDER BY using two colomns [ solved thankyou :) ] | Richard | 8 Apr |
| • Re: Help with ORDER BY using two colomns [ solved thankyou :) ] | Andy Wallace | 8 Apr |
| • Re: Help with ORDER BY using two colomns [ solved thankyou :) ] | Richard | 8 Apr |
| • Re: Help with ORDER BY using two colomns [ solved thankyou :) ] | Ben Clewett | 8 Apr |
| • Re: Help with ORDER BY using two colomns | Tim McDaniel | 8 Apr |
| • Re: Help with ORDER BY using two colomns | Ben Clewett | 8 Apr |
