rugzo Posted April 19, 2009 Share Posted April 19, 2009 Hi all, how can i count a value in a column once. I mean i have a table where many names are listed like --> john michael john sasha smith john i want to use the count() function in my query but the result for example here should be 4 and not 6. john should only be counted once. Thanks... Quote Link to comment https://forums.phpfreaks.com/topic/154763-solved-count-a-value-once/ Share on other sites More sharing options...
kickstart Posted April 19, 2009 Share Posted April 19, 2009 Hi It is a count distinct you need. Something like;- SELECT COUNT(DISTINCT FirstName) FROM TableName All the best Keith Quote Link to comment https://forums.phpfreaks.com/topic/154763-solved-count-a-value-once/#findComment-813950 Share on other sites More sharing options...
rugzo Posted April 19, 2009 Author Share Posted April 19, 2009 thanks... Quote Link to comment https://forums.phpfreaks.com/topic/154763-solved-count-a-value-once/#findComment-814040 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.