Nathaniel Price <nprice@tesseract.net> writes:
> I'm new to this list, so I'm not sure if this is the right place to post this.
> If not, please direct me to where it would be better to post it.
>
> Anyway, I'm creating a report generation tool of sorts in PHP for a database.
> As part of this report generation tool, I'd like to allow the user to reorder
> these results arbitrarily. In other words:
>
> id | offer
> ---+------------
> 1 | Offer 1
> 2 | Offer 2
> 3 | Offer 3
>
> could become
>
> id | offer
> ---+------------
> 3 | Offer 3
> 1 | Offer 1
> 2 | Offer 2
You could do something like
select id,offer
from tab
order by case when id = 3 then 1 when id = 1 then 2 when id = 2 then 3 end
But a) if there are thousands of records you're going to have rather a huge
query and b) where are you going to store this ordering?
--
greg