select greatest(a, b, c, d) from your_table;