Postgresql – Return only one element per unique ID with only latest joined record
Suppose the following: create schema bv; create table bv.user(id bigint primary key); create table bv.user_photo ( id bigint primary key, url varchar(255) not null, user_id bigint references bv.user(id) ); insert into bv.user values (100), (101); insert into bv.user_photo values (1,…