SQL MAX statement with multiples columns?

Hello,
MAX is the statement where you want to figure out maximum value of one column,
In case you want to find maximum value but based on multiple columns, is there other statement you can use alternatively?

For example, instead of writing two queries as below, can you make one query to get maximum value in money_in AND money_out columns?


SELECT MAX(money_in)
FROM transactions;

SELECT MAX(money_out)
FROM transactions;

Hello @jiyeonjang7025175947, you could write a query referencing two columns:

SELECT MAX(money_in), MAX(money, out)
FROM transaction;

This query selects the maximum value from money_in and money_out, from the table transactions.
I hope this helps!

3 Likes