Jeg tror, det er bedst at gøre det via PHP på applikationslaget, men du kan gøre det med LEAST()
og GREATEST()
:
SELECT t.id,t.description,
LEAST(t.shop1,t.shop2,t.shop3) as lowest,
(t.shop1+t.shop2+t.shop3) - (LEAST(t.shop1,t.shop2,t.shop3) + GREATEST(t.shop1,t.shop2,t.shop3)) as middle_one
GREATEST(t.shop1,t.shop2,t.shop3) as biggest
FROM YourTable t