MySQL Forums
Forum List  »  General

Select top 1 in a group?
Posted by: Tull Clancey
Date: September 28, 2018 03:47PM

Hi there. Have the following as a table, I can't change it, so I have to find a way around the problem with the sql.

node1 datetime 123
node2 datetime 223
node1 datetime 256
node2 datetime 863
etc
etc


I need to return a recordset of the last entry for each node. A kind of limit for each node name. I could do this with a couple of tableually building the result, but I'd sooner get it with one command.

I wondered if I could achieve this with GROUP, Ive been trying, but i'm not getting very far.
I'm after a sort of Select * from table group by node, order by date, limit top 1 of group.

Is this possible?

Many thanks.

Options: ReplyQuote


Subject
Written By
Posted
Select top 1 in a group?
September 28, 2018 03:47PM
September 29, 2018 07:11AM


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.