BioBob Posted October 25, 2010 Share Posted October 25, 2010 Its a fairly stright forward question I think. Lets say I have an Enum or a Set type, where I specify the specific values of the Set. Say the field is called Fruits. If I want to have more different types of Fruits available later, I can edit and add those new fruits to the set type later. So lets say for right now I have Apples, Oranges, and Bananas. In my php code, I could hard set these values, but I want to count the total number of different values, or simply return the values themselves. I'll be happy with either an INT for returning a COUNT(*) or the Value, IE mysql_fetch returns (Apples, Oranges, Bananas), so either way. The total number probably isn't going to be a very high number, single digits, maybe low double digits... How on earth would I do that? Quote Link to comment Share on other sites More sharing options...
kai555 Posted October 26, 2010 Share Posted October 26, 2010 Hi I assume you have each type of fruit more than once in your table? I think what you are looking for is: SELECT COUNT(DISTINCT column_name) as c FROM table_name Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.