List:General Discussion« Previous MessageNext Message »
From:Martijn Tonies Date:April 28 2008 12:41pm
Subject:Re: get all my newest messages
View as plain text  

> hello
>
> i have a message table like this:
>
> created datetime
> sender int
> recipient int
> message text
>
> to get all my messages i would do:
>
> select * from message where sender = $MYID or recipient = $MYID
>
> but how do i make a query that returns the rows of only the NEWEST
> messages between myself and my contacts (regardless of who sent the
> newest message)?

Define "newest".

> i tried using "group-wise maximum" mentioned in the mysql manual, but
> can't figure it out. hope someone can help. thanks!

Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, NexusDB, Oracle &
MS SQL Server
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com

Thread
get all my newest messagesOlav Mørkrid28 Apr
  • Re: get all my newest messagesOlav Mørkrid28 Apr
  • Re: get all my newest messagesMartijn Tonies28 Apr
  • Re: get all my newest messagesMartijn Tonies28 Apr
    • Re: get all my newest messagesOlav Mørkrid28 Apr
  • Re: get all my newest messagesMartijn Tonies28 Apr
    • Re: get all my newest messagesOlav Mørkrid28 Apr
  • Re: get all my newest messagesMartijn Tonies28 Apr
    • Re: get all my newest messagesOlav Mørkrid28 Apr