Jump to content

[SOLVED] mySQL Query Help


ashburnham

Recommended Posts

Probably a simple one but I'm a bit of a novice so any help would be appreciated.  Within my database I have a table called customer and a column within called refer.  The refer column is populated by a single name such as Steve, Bob, Joe, Dave, Bob, Derek, Joe, Bob, etc...

 

I want to run a query to get all occurrences of a name and the number of times it occurs and display it all in a nice little table but can't think how to do this  ???

 

Desired outcome (using the above example) should be something like:

 

Name |Occurrence

Bob|  3

Joe|  2

Dave|  1

Derek|  1

Steve|  1

 

Any help would be appreciated - thanks...

 

P.S.  Being able to sort into name or occurrences order would be preferred but not vital.

Link to comment
https://forums.phpfreaks.com/topic/78948-solved-mysql-query-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.