I would love to; but some things are easier (and better) done by you doing a bit of your own homework. You have all the pieces of the puzzle, so my advise is to spend a bit of time and learn to write an SQL query. Honestly, this is just postgres SQL query 101 stuff that can be found on myriad tutorials online.
That’s not “my thing” to repeat “tutorial 101” kinds of things on info easily found by others doing their own Google homework. That’s just me. Thanks for understanding and please forgive me for my honesty..
Note: SQL has been around since 1974, or 46 years ago. It’s a good thing to have basic SQL knowledge if you are going to admin a DB based application.