PostgreSQL
 sql >> Base de données >  >> RDS >> PostgreSQL

Algorithme de correspondance en SQL

select x.name, max(x.rank) 
from matches x
join (
    select name from matches where prop = 1 AND rank > 5
    intersect
    select name from matches where prop = 3 AND rank >= 8
) y
    on x.name = y.name 
group by x.name
order by max(rank);