Given the following table:
id message owner_id counter_party_id datetime_col
1 "message 1" 4 8 2014-04-01 03:58:33
2 "message 2" 4 12 2014-04-02 10:27:34
3 "message 3" 4 8 2014-04-03 09:34:38
4 "message 4" 4 12 2014-04-06 04:04:04
How to get the most recent counter_party number and then get all the messages from that counter_party id?
output:
2 "message 2" 4 12 2014-04-02 10:27:34
4 "message 4" 4 12 2014-04-06 04:04:04
I think a double select must work for that but I don't know exactly how to perform this.
Thanks