If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > hard query (for me atleast)

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-19-09, 20:48
Justinc Justinc is offline
Registered User
 
Join Date: Jul 2009
Posts: 2
hard query (for me atleast)

All right guys, I'm having trouble writing a query here's what I'm trying to do:

I have a column (loc) that often contains the same text, what I'm trying to do is to take a count of how many times one name shows up, and see which one shows up the most.
Here's a screenshot of what the column looks like.

I've tried doing Count distinct, but I can't get the results I need.

Thanks for any help!
Reply With Quote
  #2 (permalink)  
Old 07-19-09, 21:21
Justinc Justinc is offline
Registered User
 
Join Date: Jul 2009
Posts: 2
SELECT loc, COUNT(*) AS c
FROM log
GROUP BY loc
ORDER BY c DESC
LIMIT 1



Someone helped me over @ wht
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On