Chris Andrew writes:
> I would like to replace the hardcoded integer value 1234567,
> with a "calculated" SUM figure.
>
> SELECT SrcIp,
> SUM(Packets),
> SUM(Packets)/1234567*100 AS Percentage
> FROM tblIp
> GROUP BY SrcIp;
Either divide it into two queries and use the result
of the first when constructing the second, or (if you're
just doing raw SQL instead of using some script language)
do it to a temporary table which just contains the sum
of all Packets.
//C
--
Carl Troein - Círdan / Istari-PixelMagic - UIN 16353280
[EMAIL PROTECTED] | http://pixelmagic.dyndns.org/~cirdan/
Amiga user since '89, and damned proud of it too.
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php