ok, trying build conversation list in php of messages user has. database setup there 4 fields, sender id, receiver id, timestamp, , message. query returns every result receiver id equals current users id. want select first occurrences of every sender's id. ie:
================================================== | sender id | receiver id | time | message | ================================================== | 2 | 1 | 1373914164 | test | <--- 1 | 2 | 1 | 1373914155 | ..test | | 1 | 1 | 1373914134 |...test | <--- 1 | 2 | 1 | 1373914111 | test. | | 1 | 1 | 1373914108 | test..| | 3 | 1 | 1373914102 | test | <--- 1 | 3 | 1 | 1373914101 | test | ==================================================
my idea filter results in array using php, i'm @ total brain fart here. ideas?
you can sql sorting time , limiting 1
something like
select .... order time desc limit 1
Comments
Post a Comment