Skip to content
Advertisement

How to find the max values of each columns using a single SQL query

I have a table, I want to get all the max values of col1, col2, col3 using one query only. I’m using sqlite and flask-sqlalchemy.

I tried

but then I got [(88,), (30,), (75,), (93,)]

I want the output to be

[(93,), (88,), (75,)]

How can I do this?

Advertisement

Answer

I think you want three separate calls to MAX here:

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement