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

PostgreSQL :syntaxe de jointure externe gauche

select u.id,
       u.first_name,
       u.city,
       u.avatar,
       coalesce(m.money,0),
       u.login > u.logout as online
  from pref_users u left outer join pref_money m on u.id=m.id
       and m.yw=to_char(current_timestamp, 'YYYY-IW') 
 where u.id='DE2'
 order by m.money desc;