Say, I\'ve a table like this:
I want to find the pair of Centers whose Performance difference is highest for each session, like this:
I have th
select distinct(session) * from (
select t1.session, t1.center, t2.center,
(case when t1.performance > t2.performance then (t1.performance-t2.performance) else (t2.performance-t1.performance))as performance_diff
from mytable t1, mytable t2
where t1.session=t2.session and t1.center!=t2.center) as T1 order by session,performance_diff desc limit 1;