<strong>Sample Database Table called test</strong>
Sample Database Table called test
I am trying to get the row that has the highest priority within the last and same height
Here is what I have tried so far
I first tried getting the highest priority in the table and I successfully got the result by using the query below
SELECT * FROM test WHERE priority = (SELECT MAX(priority) FROM test)
Now, I thought this query would work but this throws an error message.
SELECT * FROM test WHERE priority = (SELECT MAX(priority) FROM test ORDER BY height DESC)
ERROR: column "t2.height" must appear in the GROUP BY clause or be used in an aggregate function
Can anyone guide me how to solve this?
Learn PostgreSQL, PgAdmin, SQL and JDBC [Combo!]
What is CRUD? | CRUD Operations with SQL and PostgreSQL - In this course we will be using SQL and PostgreSQL to perform CRUD operations
In this tutorial, you will learn how to write simple SQL queries in PostgreSQL.