SELECT *
FROM (
SELECT uid,
title,
amount,
maker,
widgets,
rank() over (partition by maker order by amount desc) as rank
FROM entry
) t
WHERE rank <= 3
More Related Contents:
- Select first row in each GROUP BY group?
- Optimize GROUP BY query to retrieve latest row per user
- How to select id with max date group by category in PostgreSQL?
- SQL query to get most recent row for each instance of a given key
- Optimize groupwise maximum query
- Get values from first and last row per group
- Get most common value for each value of another column in SQL
- Conditional lead/lag function PostgreSQL?
- How to return result of a SELECT inside a function in PostgreSQL?
- Oracle SQL query: Retrieve latest values per group based on time [duplicate]
- Possible to perform cross-database queries with PostgreSQL?
- Reset auto increment counter in postgres
- Optimize query with OFFSET on large table
- GROUP BY and aggregate sequential numeric values
- Safely rename tables using serial primary key columns
- How to use (install) dblink in PostgreSQL?
- get JOIN table as array of results with PostgreSQL/NodeJS
- How can I send email from PostgreSQL trigger?
- Postgres manually alter sequence
- What’s the proper index for querying structures in arrays in Postgres jsonb?
- Postgres sql insert query syntax error from phpPgAdmin
- Combine two columns and add into one new column
- Bulk/batch update/upsert in PostgreSQL
- Grant privileges for a particular database in PostgreSQL
- Timestamp Difference In Hours for PostgreSQL
- SQL INSERT without specifying columns. What happens?
- Getting results between two dates in PostgreSQL
- How to perform a select query in a DO block?
- Subtract hours from the now() function
- Query for count of distinct values in a rolling date range