| | |
Need help with grouping
Please support our MySQL advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Aug 2008
Posts: 2
Reputation:
Solved Threads: 0
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:
Here is the query I currently have which fails miserably.
Which returns:
Help is greatly appreciated. Thanks.
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:
MySQL Syntax (Toggle Plain Text)
Hits | Page URL | Keywords ========================= 3 | http://url.com/ | 2
Here is the query I currently have which fails miserably.
MySQL Syntax (Toggle Plain Text)
SELECT A.page_url, A.page_title, B.total_terms, B.hits FROM visits A INNER JOIN (SELECT search_terms, search_temrs, COUNT(*) AS hits FROM searches GROUP BY url_path, search_terms ) B ON A.page_url = B.url_path GROUP BY A.page_url, B.search_terms
Which returns:
MySQL Syntax (Toggle Plain Text)
HITS PAGE_TITLE PAGE_URL TOTAL_TERMS 1 1 page http://url.com/ 1 2 2 page http://url.com/ 2
Help is greatly appreciated. Thanks.
Last edited by drewtemp; Aug 13th, 2008 at 12:48 pm.
![]() |
Similar Threads
- mysql query headaches - sorting/grouping (PHP)
- Is Complex grouping possible in JSP (JSP)
- TOP seven data and grouping (MS SQL)
- Try Grouping Files for Effortless Manageability (Windows tips 'n' tweaks)
- Group files by Artist in XP (Windows NT / 2000 / XP)
- New To Programming = ME!! (C++)
- KDE and Gnome = Bloatware (Window and Desktop Managers)
- Group Project Ideas (Geeks' Lounge)
Other Threads in the MySQL Forum
- Previous Thread: MySQL multitable select problem.
- Next Thread: how to use an input parameter in where clause?
| Thread Tools | Search this Thread |
agplv3 alfresco amazon api artisticlicense aws bizspark breathalyzer camparingtocolumns changingprices cmg communityjournalism contentmanagement contractors copyright count court crm database design developer development distinct drupal dui ec2 email enterprise eudora facebook form foss gartner gnu government gpl greenit groupware hiring hyperic images innerjoins insert ip joebrockmeier join keyword keywords kickfire laptop law legal license licensing linux maintenance managing mariadb matchingcolumns metron micromanage microsoft microsoftexchange mindtouch montywidenius mozilla multiple music mysql mysqlcolumnupdating mysqldatetimeordermax() mysqlindex mysqlinternalqueries mysqlquery mysqlsearch news open-xchange opendatabasealliance opengovernment opensource oracle penelope priceupdating query referencedesign reorderingcolumns resultset saas select sharepoint simpledb sourcecode spotify sql sugarcrm syntax techsupport thunderbird transparency virtualization





