MySQL Forums
Forum List  »  General

Re: Problem on listing query results
Posted by: Nick Roper
Date: August 02, 2004 02:55AM

Hi Gleidson,

Here's a solution:

-----------------------------------------------------

DROP TABLE IF EXISTS temp;

CREATE TABLE temp
SELECT ID, USER, max(DATA) as user_data
from users
group by USER;

SELECT users.ID, users.USER, users.DATA
from users, temp
where users.USER = temp.USER
and users.DATA = temp.user_data
order by users.DATA desc;

-----------------------------------------------------


(Based on a technique described in MySQL Cookbook by Paul Dubois ISBN 0-596-00145-2)

--
Nick Roper

Options: ReplyQuote


Subject
Written By
Posted
Re: Problem on listing query results
August 02, 2004 02:55AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.