> On 28/04/2008, Martijn Tonies <[EMAIL PROTECTED]> 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:
select *
from ( select * from msgs order by msgs.created desc ) t
where sender = 1 or recipient = 1
group by sender, recipient
Martijn Tonies
Database Workbench - development tool for MySQL, and more!
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]