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
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:
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
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
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:
-
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
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
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
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