I am writing a chat app and want to get a list of recent contacts to show in the sidebar. My table has the standard chat fields (sender, receiver, msg, date). I’m currently getting a list of recent contacts by getting a list of messages with distinct (sender, receiver) pair: The result returned is wrong as it doesn’t contain the
Tag: distinct-on
How to get first row of data for each month (postgres)
I am a beginner in postgres and would like to get the first row for each month (group by) but I’m not really sure how. My table order is as per below: order_id | cust_id | order_date ——————…
Remove Duplicate Result on Query
could help me solve this duplication problem where it returns more than 1 result for the same record I want to bring only 1 result for each id, and only the last history of each record. My Query: Result of my query, but returns 3 or 5 identical ids with different histories I want to return only 1 id of