sorting - MySQL: Sort by single values in different columns -


my table looks (simplified):

name  result1  result2  result3        15     17        24 b       30     31        21 c       27     19        39 

now want sort results in columns result1, result2 , result3 ranking sorted lowest highest values in these columns.

the results should this

name  result     15     17 c     19 b     21     24 c     27 b     30 b     31 c     39 

i don't have idea how sort values in different columns paying attention every single value , not max or min. can me?

thanks in advance.

try this

select name,result  ( select name,  result1 result  yourtable union select name,  result2 result  yourtable   union select name,  result3 result  yourtable  ) t  order result  

Comments

Popular posts from this blog

vb.net - Alternative to the T-SQL AS keyword -

php - MySQLi binding parameters in a prepared statement doesn't work unless inserted after "WHERE" -

ios - CFRelease causing crash in iPad application -