Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

Count multiple secondary children values as one

1:24 pm on Jan 28, 2011 (gmt 0)

Junior Member

5+ Year Member

joined:June 10, 2007
posts: 104
votes: 0

Hi there,

I have this db:

id domain page clicks
1 domain1.com /about_us 11
2 domain1.com /contact 22
3 domain2.com /about_us 33
3 domain2.com /some_page 44

Is it possible to do an automated query, without any PHP usage, to count all page clicks, but refer it to as the parent domain name?

The output that I'm trying to achieve:

domain1.com 33
domain2.com 77

Thanks ;)
5:58 pm on Jan 28, 2011 (gmt 0)


WebmasterWorld Administrator coopster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:July 31, 2003
votes: 2

SELECT domain, SUM(clicks) AS totalClicks FROM table GROUP BY domain

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members