Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Dave Brown
October 20, 2005, 12:40 am
rate this thread
Trying to get a simple query going using group by and order by
I need to retrieve the latest record ordered by datetimestamp desc but
grouped by my nodeID column...
my data is thus;
7000802818, 2005-10-10 17:13:43
4, 2005-10-10 17:13:44
4, 2005-10-10 17:13:45
5, 2005-10-10 17:13:4
the first column being the nodeID, the second being the datetimestamp...
I cant seem to get the bleeder to work :(
Can anyone offer any assistance ?
Re: Having problem getting group by to work with order by
solution to the problem i had below..
select t1.serialno, t1.NodeID, t1.datetimestamp, t1.latitude,t1.longitude
from trackinglogs t1, trackinglogs t2
where t1.serialno = t2.serialno
group by t1.nodeid desc
having MAX(t1.datetimestamp) = MAX(t2.datetimestamp);
Dave Brown wrote:
- » Americanas.com SALDO de TVs Com at 80% de Desconto (29798)
- — Newest thread in » MySQL Database Forum