Ah, I thought the field held a number.  So use Count() instead of sum().



Dennis,
Webmaster - www.halomaps.org
.================================================.
|Halo Maps Website   - http://www.halomaps.org   |
|Halo Movies Website - http://www.halomovies.org |
|Halo CE Chronicles  - http://hcec.halomaps.org  |
.================================================.


-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of
Jason King
Sent: Wednesday, July 21, 2010 4:48 PM
To: [email protected]
Subject: Re: [OpenBD] SQL Question (using openbd).. maybe you guys can help

(
Select
Sum(dns_hit_id) As dnshits
>From dns_hits
Where dns_hits.dns_id = dns.dns_id
)
AS Totalhits


This is close. However, I'm summing the wrong value.

What I'm getting is a sum of the dns_hit_id's, not the amount of records.

So if there are 3 hits

ID - TIME - IP

56 - 07/19/2010 5:45pm - 66.76.125.23
78 - 07/19/2010 8:35pm - 62.26.225.13
156 - 07/21/2010 1:15pm - 55.12.12.33

The code above is summing the ID's, which in the case would be 56+78+156 =
290

So 'TotalHits' is set to 290, when what I want is it to be set to '3'
(because there is 3 records)

Any ideas?

-- 
Open BlueDragon Public Mailing List
 http://www.openbluedragon.org/   http://twitter.com/OpenBlueDragon
 online manual: http://www.openbluedragon.org/manual/

 mailing list - http://groups.google.com/group/openbd?hl=en

-- 
Open BlueDragon Public Mailing List
 http://www.openbluedragon.org/   http://twitter.com/OpenBlueDragon
 online manual: http://www.openbluedragon.org/manual/

 mailing list - http://groups.google.com/group/openbd?hl=en

Reply via email to