View Single Post

   
  #1 (permalink)  
Old 04-29-2008, 08:27 PM
=?ISO-8859-1?Q?Olav_M=F8rkrid?=
 
Posts: n/a
Default get all my newest messages

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)?

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