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 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? 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 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. 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 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
Archived
This topic is now archived and is closed to further replies.