MySQL Forums
Forum List  »  Newbie

MAX and GROUP problem. Help!
Posted by: 359359
Date: May 19, 2005 03:01AM

Hi,
I have the following table (sss.test):
'DATE', 'TIME', ELEMENT', VALUE'
('2005-05-14','00:00:00','A','40');
('2005-05-14','00:00:00','B','10');
('2005-05-14','00:00:00','C','15');
('2005-05-14','00:00:00','D','40');
('2005-05-14','00:15:00','A','50');
('2005-05-14','00:15:00','B','20');
('2005-05-14','00:15:00','C','60');
('2005-05-14','00:15:00','D','10');
('2005-05-14','00:30:00','A','10');
('2005-05-14','00:30:00','B','230');
('2005-05-14','00:30:00','C','20');
('2005-05-14','00:30:00','D','30');
('2005-05-14','00:45:00','A','50');
('2005-05-14','00:45:00','B','60');
('2005-05-14','00:45:00','C','30');
('2005-05-14','00:45:00','D','50');
('2005-05-14','01:00:00','A','60');
('2005-05-14','01:00:00','B','760');
('2005-05-14','01:00:00','C','30');
('2005-05-14','01:00:00','D','20');
('2005-05-14','01:15:00','A','230');
('2005-05-14','01:15:00','B','4450');
('2005-05-14','01:15:00','C','30');
('2005-05-14','01:15:00','D','60');

I would like to SELECT for each ELEMENT the MAX VALUE but when I am using the
SELECT DATE, TIME, ELEMENT, MAX(VALUE)
FROM sss.test
group by ELEMENT

I am geting the correct MAX VALUE but the TIME is always '00:00:00' . Please Help!!
Thank you in advance.

Options: ReplyQuote


Subject
Written By
Posted
MAX and GROUP problem. Help!
May 19, 2005 03:01AM


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.