Hi everybody, here I am the last day of the year with one problem...
this is my table:
what I want is:Code:id useridfrom useridto message 1 5 15 A 2 5 15 B 3 10 8 C 4 2 15 D 5 10 15 E 6 2 6 F 7 10 15 G
for one useridto (for example, useridto=15) I want the max(id) for each useridfromCode:id useridfrom message 2 5 B 4 2 D 7 10 G
I thought I could use this query:
but the result doesnīt seem to be correctCode:SELECT max( id ) , useridfrom, message FROM messages WHERE useridto =15 GROUP BY useridfrom
any idea about how can I do it? if itīs not possible with group, how could I do it?
Iīm using mysql 4.0.22
thanks and happy new year![]()




Bookmarks