Occurrence Of Number Set In MySQL

Discussion in 'Web Design and Development' started by Vitaminwater, Apr 18, 2010.

  1. Vitaminwater macrumors newbie

    Aug 18, 2009
    Good afternoon everyone!

    I was racking my brain today trying to figure out how I could possible figure out the number of occurrence's everything in my database has. I DO NOT want to search for an item and have it tell me how many times it happens in a database.

    I want to query an entire column and count how many times it see's , 'XXXXX' and 'YYYYY'. And then output the top 5 most used number sets.

    Can anyone shed any light on this? Maybe with arrays? I'm not sure...

    Thanks Alot!
  2. jpyc7 macrumors 6502

    Mar 8, 2009
    Denver, CO
    I did not test these queries, but I think you want something like:

    select count(*) as qty, col_name from table_name group by col_name order by qty desc;

    Or maybe something like:
    select count(distinct col_name) from table_name;

Share This Page