> On 28/04/2008, Martijn Tonies <m.tonies@stripped> wrote:
> > > 1. the newest message between myself and person A
> > > 2. the newest message between myself and person B
> > > 3. the newest message between myself and person C
> > > 4. the newest message between myself and person D
> > Still, define "newest":
> > - newest according to date?
> > - newest not yet read message?
> > - something else?
> newest according to date of creation.
There are probably other solutions, but this seems to work:
from ( select * from msgs order by msgs.created desc ) t
where sender = 1 or recipient = 1
group by sender, recipient
Database Workbench - development tool for MySQL, and more!
Database development questions? Check the forum!