Current location: Hot Scripts Forums » Programming Languages » PHP » most occurance of a string in a table


most occurance of a string in a table

Reply
  #1 (permalink)  
Old 11-15-04, 02:06 PM
perleo perleo is offline
Coding Addict
 
Join Date: Jul 2003
Location: Ireland
Posts: 269
Thanks: 0
Thanked 0 Times in 0 Posts
most occurance of a string in a table

how do i select the most occurance of a string from a column, eg

table: test
column: column

if i have these rows,

hello
world
hello

hello occures most, how does mysql select this?
Reply With Quote
  #2 (permalink)  
Old 11-15-04, 02:16 PM
nekeno12 nekeno12 is offline
Wannabe Coder
 
Join Date: May 2004
Location: CO
Posts: 214
Thanks: 0
Thanked 0 Times in 0 Posts
SELECT column,SUM(column) FROM table
GROUP BY column
HAVING SUM(column)>1
Reply With Quote
  #3 (permalink)  
Old 11-15-04, 04:11 PM
Sabu Sabu is offline
Junior Code Guru
 
Join Date: Sep 2004
Posts: 458
Thanks: 0
Thanked 0 Times in 0 Posts
You might want to tack a "LIMIT 1" on to the end of that
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with a sort table js function tdubyou JavaScript 0 05-03-04 09:19 AM
auto table resize derick_2k JavaScript 4 04-26-04 02:32 PM
Newbie MySQL fccolon PHP 2 03-16-04 10:54 AM
Declared Functions skipper23 PHP 4 12-17-03 10:06 AM
index page not showing up skipper23 PHP 3 12-15-03 01:10 PM


All times are GMT -5. The time now is 05:13 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.