LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 01-30-2007, 07:17 PM   #1
MicahCarrick
Member
 
Registered: Jul 2004
Distribution: Fedora
Posts: 241

Rep: Reputation: 31
SQL SELECT Group by 2 conditions


I have a table which stores search phrases and IP addresses. I want to execute a query that will give me each search phrase along with the number of unique IPs associated with that phrase. How can I accomplish this "nested" group by?

Code:
SELECT search_phrase, COUNT(*) as c FROM search_tracking GROUP BY search_phrase ORDER BY c DESC
The above obviously groups the search_phrases but does not account for a single user searching for that phrase over and over. Any help?
 
Old 01-30-2007, 11:02 PM   #2
graemef
Senior Member
 
Registered: Nov 2005
Location: Hanoi
Distribution: Fedora 13, Ubuntu 10.04
Posts: 2,379

Rep: Reputation: 148Reputation: 148
Would SELECT DISTINCT... help you here?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Spam limiter for specific conditions. longnshortofit Linux - Security 8 03-12-2006 07:53 PM
Find command using 2 search conditions nifflerX Linux - General 8 07-15-2005 02:37 PM
Sql + Oracle Select If ???? smaida Programming 11 12-15-2004 09:13 PM
Expect test conditions jnusa Programming 0 08-18-2004 05:32 AM
Bizarre SQL select query acid_kewpie Programming 6 01-20-2004 01:47 PM


All times are GMT -5. The time now is 01:10 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration