Search
 
SCRIPT & CODE EXAMPLE
 

SQL

postgresql select top 1 from each group

SELECT rank_filter.* FROM (
        SELECT items.*, 
        rank() OVER (
            PARTITION BY color
            ORDER BY created_at DESC
        )
        FROM items
        WHERE items.cost < 50
    ) rank_filter WHERE RANK = 1
Comment

PREVIOUS NEXT
Code Example
Sql :: query to get all primary keys and foreign key 
Sql :: sql creating tables 
Sql :: redirection 301 htaccess nom de domaine 
Sql :: mysql not 
Sql :: sql default 
Sql :: Oracle cx_Oracle example 
Sql :: WHERE value IS sql 
Sql :: insert into from 
Sql :: oracle cache matching 
Sql :: sql full outer join 
Sql :: android sqlite get rows count 
Sql :: hour differeence in mysql 
Sql :: mysql earlier than date 
Sql :: sql delete table 
Sql :: data types mysql vs postgresql 
Sql :: SQL SMALLDATETIME Data Type 
Sql :: connect laravel to mysql on mac 
Sql :: Deleting data from tables 
Sql :: insert value to new table by joining 2 different tables 
Sql :: what is mysql 
Sql :: Selecting from a view SQL 
Sql :: Why mysql is used? 
Sql :: sql check if column exists 
Sql :: sql Not like operator 
Sql :: insert overwrite table in mysql in nifi 
Sql :: sql examples from framework 
Sql :: rasa mysql connection custom actions example 
Sql :: postgresql interview questions 
Sql :: from UCSC MySQL database Use database hg38. 
Sql :: mysql use password error 
ADD CONTENT
Topic
Content
Source link
Name
7+6 =