Do you have a question? Post it now! No Registration Necessary. Now with pictures!
November 23, 2005, 10:12 am
rate this thread
Just wondering if anyone could help me optimise this query, it can take
up to 3 seconds to execute which makes me think theres probably a
better way to do what i'm doing..
SELECT MAX(Latitude) as "MaxLat",MIN(Latitude) as
"MinLat",MAX(Longitude) as "MaxLong",Min(Longitude) as "MinLong",
count(filtered.serialno) as "count"
FROM trackinglogs tl LEFT JOIN trackinglogs AS t2
ON tl.nodeid=t2.nodeid AND tl.datetimestamp < t2.datetimestamp
WHERE t2.nodeid IS NULL) as filtered
JOIN usernodes un on (filtered.nodeid = un.nodeid)
WHERE un.userid = 99;
Basically i'm trying to get the maximum / minimum latitude and
longitude values from a position log for a particular user , (who may
have > 1 node giving lat long data)...
I've indexed every field used in the where/join statements.
Any advice appreciated, thanks
- » Americanas.com SALDO de TVs Com at 80% de Desconto (29798)
- — Newest thread in » MySQL Database Forum