Check out example codes for "postgresql left join distinct on". It will help you in understanding the concepts better.

Code Example 1

Select Distinct On (u.username, u.email)
     u.username
    ,u.email
    ,l.browser
    ,l.login_time
From users u
Join logins l On l.username = u.username
Order By u.username, u.email, login_time Desc
 
                                        ^

Learn ReactJs, React Native from akashmittal.com