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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.