Do you have a question? Post it now! No Registration Necessary. Now with pictures!
November 25, 2005, 6:31 pm
rate this thread
The following query is one i'd love to be able to use, but cant...
select nodeid,max(datetimestamp) as datetimestamp,latitude,longitude
group by nodeid
order by datetimestamp desc;
I'm trying to get the latest rows according to datetimestamp column,
for each unique nodeid in my table.. however the above query works to
an extent but the lat & long columns dont correspond with the same row
as the datetimestamp..
So my alternative was this...
FROM trackinglogs tl LEFT JOIN trackinglogs AS t2
ON tl.nodeid=t2.nodeid AND tl.datetimestamp < t2.datetimestamp
WHERE t2.nodeid IS NULL;
which produces the correct results but is slow, taking 2-3 seconds on a
table with 1200 rows, which will be growing considerably over time..
So i'm stuck at what to do really..
Any thoughts/advice would be really appreciated.
- » Americanas.com SALDO de TVs Com at 80% de Desconto (29798)
- — Newest thread in » MySQL Database Forum
- » ssh on command line: force using a group size (prime size) of 1024 (and no...
- — The site's Newest Thread. Posted in » Secure Shell Forum