How to find the maximum value for each column of a table?

I was just stuck looking for the exact query for this requirement.
I want to find the maximum value in each column.

Here is an example

ABCD ------- 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 | 

Would that be more helpful if you could help me?

+6
source share
3 answers
 SELECT MAX(A) max_a, MAX(B) max_b, MAX(C) max_c, MAX(D) max_d FROM tablename 
+4
source
 select max(a) as A ,max(b) as B , max(c) as C , max(d) as D from tablename 
+1
source

select max(A) as A, max(B) as B, max(C) as C, max(D) as D from my_table ;

+1
source

All Articles