How to find the max value of every column in a table?

max, mysql, sql

Solution

SELECT MAX(A) max_a,
       MAX(B) max_b,
       MAX(C) max_c,
       MAX(D) max_d
  FROM tablename

Problem

I just got stucked in finding the exact query for this requirement. I want to find the max value in every column. Here is an example ``` A B C D ------- 0 3 4 1 4 1 5 3 5 9 6 7 7 2 1 6 ``` The result should be like this: ``` A | B | C | D | -------------- 7 | 9 | 6 | 7 | ``` That would be more helpful if you could help me out?

Original source