beyzad Posted March 2, 2009 Share Posted March 2, 2009 Hi guys. I have a table named 'USER' with two fields `name` , `l_name` Every one can write they name and last names in form and that will be inserted as a row. How can i count each users rows? For example: John kain : 2 times David potter : 1 times Samuel haug : 13 times Thanks Quote Link to comment https://forums.phpfreaks.com/topic/147559-solved-how-to-count-same-rows-in-one-table/ Share on other sites More sharing options...
fenway Posted March 2, 2009 Share Posted March 2, 2009 Huh? Why are you storing first/last multiple times? Quote Link to comment https://forums.phpfreaks.com/topic/147559-solved-how-to-count-same-rows-in-one-table/#findComment-774642 Share on other sites More sharing options...
beyzad Posted March 2, 2009 Author Share Posted March 2, 2009 Hi. It is my program defaults. i know there is many easier way to do this, but i please want to know what is the query that do that? This is a voting program that the users are not predefined. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/147559-solved-how-to-count-same-rows-in-one-table/#findComment-774648 Share on other sites More sharing options...
fenway Posted March 3, 2009 Share Posted March 3, 2009 Hi. It is my program defaults. i know there is many easier way to do this, but i please want to know what is the query that do that? This is a voting program that the users are not predefined. Thanks I don't understand. Quote Link to comment https://forums.phpfreaks.com/topic/147559-solved-how-to-count-same-rows-in-one-table/#findComment-775339 Share on other sites More sharing options...
dreamwest Posted March 3, 2009 Share Posted March 3, 2009 I have a table named 'USER' with two fields `name` , `l_name` Every one can write they name and last names in form and that will be inserted as a row. How can i count each users rows? Would be easier to use one column for 1st and last names As they are... COUNT(*) FROM USER WHERE name = 'John' AND l_name = 'kain' If you want it more dynamic youll have to join the columns first......simple Quote Link to comment https://forums.phpfreaks.com/topic/147559-solved-how-to-count-same-rows-in-one-table/#findComment-775352 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.