Is there a reason you can't do that now with a limit 1/order by/union all? Just have it ordered one way on the first query and the other on the bottom. That will give you two rows that are the first / last in your set based on whatever column you order on.