You are looking for a mysql query to get the value of the column other than the same row

advertisements

Looking for mysql query to get the column value other than except same row

USER  VALUE
----------
Mike  15
Bob   16
Bunny 60
Mike  20
Bob   15
Bunny 20

Output Should be in below format:

USER VALUE

Mike   16
Mike   60
Bob    20
Bob    60
Bunny  15
Bunny  16


Very strange request. Here is one method that should work for the data in your question:

select t.user, group_concat(t2.value order by t2.value)
from t join
     t t2
     on t2.user <> t.user
group by t.user;