get all my newest messages

2008-04-28 Thread Olav Mørkrid
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

Re: get all my newest messages

2008-04-28 Thread Olav Mørkrid
just to clarify, i want the 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 ... and so on -- MySQL General Mailing List For list archives:

Re: get all my newest messages

2008-04-28 Thread Martijn Tonies
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

Re: get all my newest messages

2008-04-28 Thread Martijn Tonies
hi, i posted this clarification just after the original posting. what i want is: 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

Re: get all my newest messages

2008-04-28 Thread Olav Mørkrid
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: -

Re: get all my newest messages

2008-04-28 Thread Martijn Tonies
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

Re: get all my newest messages

2008-04-28 Thread Olav Mørkrid
On 28/04/2008, Martijn Tonies [EMAIL PROTECTED] wrote: select * from ( select * from msgs order by msgs.created desc ) t where sender = 1 or recipient = 1 group by sender, recipient not quite right. first comes all of MY newest messages, then comes all of THEIR newest messages. for

Re: get all my newest messages

2008-04-28 Thread Martijn Tonies
select * from ( select * from msgs order by msgs.created desc ) t where sender = 1 or recipient = 1 group by sender, recipient not quite right. first comes all of MY newest messages, then comes all of THEIR newest messages. for example: S R 1 2 1 3 1 5 1 7 2 1 5 1 the

Re: get all my newest messages

2008-04-28 Thread Olav Mørkrid
Exactly. 2008/4/28, Martijn Tonies [EMAIL PROTECTED]: select * from ( select * from msgs order by msgs.created desc ) t where sender = 1 or recipient = 1 group by sender, recipient not quite right. first comes all of MY newest messages, then comes all of THEIR newest