You are not logged in.
SELECT uid,header, click,ip,SUM(seconds),COUNT(*),
(SELECT SUM(seconds)
FROM my.site
WHERE (uid,header,click,ip) =
(w.uid,w.header,w.click,w.ip)) AS mseconds,
(SELECT COUNT(*)
FROM my.site
WHERE (uid,header,click,ip) =
(w.uid,w.header,w.click,w.ip)) AS mrows
FROM my.site AS w
WHERE (header, click, ip) = (oheader,oclick,oip)
GROUP BY uid,header,oheader,oclick,ip,oip
ORDER BY ip DESC
It's slow. Please help to optimize. I think I need a join but don't know how?
% whereis whatis whence which whoami whois who
Offline
Can you explain what exactly you want to do?
I dont really understand why you did Count(*) and sum twice...
@+
Shaika-Dzari
http://www.4nakama.net
Offline
The count(*) is done because the there are two different WHERE clauses, so the number of results returned for each would be different.
I added indexes and it's a hell of a lot faster.
Thanks
% whereis whatis whence which whoami whois who
Offline