| Andrew Rosolino 2006-01-03, 3:23 am |
| ------ =_NextPart_000_0001_
01C60FF8.538F3CC0
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Hi I need some optimization help.
=20
I currently have this query "SELECT COUNT(*) as count,sum(p.amt) as
total,p.batch,m.username,m.id,p. method,DATE_FORMAT(p
.occur, '%M %d, %Y') =
as
dateBought FROM pay p LEFT JOIN members m ON m.id=3Dp.mid WHERE
p.method!=3D'none' AND p.method!=3D'' GROUP BY p.batch ORDER BY p.occur =
DESC"
=20
Now I have an index on batch,method but that does not help because its =
using
filesort when ordering because of "occur".
=20
Also I wanted to know if there is a way to optimize SUM, and does
DATE_FORMAT slow down queries, would it be faster to run my own php date
function once i get there queries.
=20
Thanks,
Andrew
=20
=20
------ =_NextPart_000_0001_
01C60FF8.538F3CC0--
|