--- Begin Message ---
Hi,
what you want is probably described in:
http://dev.mysql.com/doc/refman/5.0/en/example-maximum-column-group-row.html

/Johan

The Nice Spider skrev:
not works. it's still show same result. any idea?

----- Original Message ----- From: "Quentin Bennett"
<[EMAIL PROTECTED]>
To: "The Nice Spider" <[EMAIL PROTECTED]>;
<mysql@lists.mysql.com>
Sent: Thursday, August 10, 2006 12:43 PM
Subject: RE: Group by base on latest time field,
possible?


Try

select thread, subject, max(time)
from jos_sb_messages
group by thread
order by 3

-----Original Message-----
From: The Nice Spider
[mailto:[EMAIL PROTECTED]
Sent: Thursday, 10 August 2006 4:10 p.m.
To: mysql@lists.mysql.com
Subject: Group by base on latest time field,
possible?

I want the group by result take the latest field,
but
my query result look
like get the random row.
Here I described:

Thread Subject                    Time
-----------------------------------------
5         Re:test 3333333333 1155203794
5         test 3333333333      1155203772
8         test 444                    1155203882
8         Re:test 444               1155203897

note: "time" field is INT(11) to store datetime in
integer value

QUERY
---------
select thread, subject, time
from jos_sb_messages
group by thread
order by time

RESULT
----------
5 Re:test 3333333333 1155203794
8 test 444                    1155203882

What do I need is:
------------------
5         Re:test 3333333333 1155203794
8         Re:test 444                1155203897

I am using 3.23.58 for Windows.
How to get the result as I expected?


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam
protection around
http://mail.yahoo.com

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:
http://lists.mysql.com/[EMAIL PROTECTED]
The information contained in this email is
privileged and confidential and
intended for the addressee only. If you are not the
intended recipient,
you
are asked to respect that confidentiality and not
disclose, copy or make
use
of its contents. If received in error you are asked
to destroy this email
and contact the sender immediately. Your assistance
is appreciated.
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:
http://lists.mysql.com/[EMAIL PROTECTED]



__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
begin:vcard
fn;quoted-printable:Johan H=C3=B6=C3=B6k
n;quoted-printable:H=C3=B6=C3=B6k;Johan
org:Pythagoras AB
email;internet:[EMAIL PROTECTED]
tel;work:+46 8 7600010
x-mozilla-html:FALSE
url:http://www.pythagoras.se
version:2.1
end:vcard


--- End Message ---
-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to