Re: RE£º[PHP-DB] How do I do math with a

Re: RE£º[PHP-DB] How do I do math with a

am 17.04.2011 05:23:31 von ron.piggott

------=_NextPart_000_0047_01CBFC8D.4CD559F0
Content-Type: text/plain;
charset="gb2312"
Content-Transfer-Encoding: quoted-printable


Thank you for the suggestion. This is the actual query that I =
implemented: Amazing how this works. Ron

SELECT SUM( `impressions_total` ) AS impressions_total , SUM( =
`usage_total` ) AS usage_total FROM ( =20

(

SELECT IF ( SUM( `web_advertisements_our_clients_usage`.`impressions` ) =
, SUM( `web_advertisements_our_clients_usage`.`impressions` ) , 0 ) AS =
impressions_total, IF ( SUM( =
`web_advertisements_our_clients_usage`.`usage` ) , SUM( =
`web_advertisements_our_clients_usage`.`usage` ) , 0 ) AS usage_total =
FROM `web_advertisements_our_clients_usage` WHERE =
`web_advertisements_our_clients_reference` =3D =
$web_advertisements_our_clients_reference AND `month` =3D $stats_month =
AND `year` =3D $stats_year LIMIT 1

) UNION ALL (

SELECT `impressions` AS impressions_total, `usage` as usage_total FROM =
`web_advertisements_our_clients` WHERE `reference` =3D =
$web_advertisements_our_clients_reference LIMIT 1

)

) AS monthly_stats_total;

The Verse of the Day
¡°Encouragement from God¡¯s Word¡±
http://www.TheVerseOfTheDay.info =20


------=_NextPart_000_0047_01CBFC8D.4CD559F0--