Need help with grouping

Reply

Join Date: Aug 2008
Posts: 2
Reputation: drewtemp is an unknown quantity at this point 
Solved Threads: 0
drewtemp drewtemp is offline Offline
Newbie Poster

Need help with grouping

 
0
  #1
Aug 13th, 2008
Hey guys,

I need a "little" help with a query. I'm trying to pull information regarding referrals from search engines which grab the keywords. For example, two people search for foobar and another searches for barfoo. I would need the results returned similar to this:
  1. Hits | Page URL | Keywords
  2. =========================
  3. 3 | http://url.com/ | 2

Here is the query I currently have which fails miserably.
  1. SELECT A.page_url, A.page_title, B.total_terms, B.hits
  2. FROM visits A
  3. INNER JOIN
  4. (SELECT search_terms, search_temrs, COUNT(*) AS hits
  5. FROM searches
  6. GROUP BY url_path, search_terms
  7. ) B
  8. ON A.page_url = B.url_path
  9. GROUP BY A.page_url, B.search_terms

Which returns:
  1. HITS PAGE_TITLE PAGE_URL TOTAL_TERMS
  2. 1 1 page http://url.com/ 1
  3. 2 2 page http://url.com/ 2

Help is greatly appreciated. Thanks.
Last edited by drewtemp; Aug 13th, 2008 at 12:48 pm.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC