ankur0101 Posted July 9, 2013 Share Posted July 9, 2013 Hi, I have table structure as follows : Name Amount ================= John 500 John 300 John 200 Danny 250 Danny 250 ================= Now I want to fetch data according to follows : John => 1000 Danny => 500 I tried lot of logics but nothing still working perfectly. I am using codeigniter. But if I will get PHP code to fetch like that, I can manage things in codeigniter. Thanks Link to comment https://forums.phpfreaks.com/topic/279998-how-to-fetch-unique-names-from-columns/ Share on other sites More sharing options...
mac_gyver Posted July 9, 2013 Share Posted July 9, 2013 SELECT Name, SUM(Amount) as amt FROM your_table GROUP BY Name Link to comment https://forums.phpfreaks.com/topic/279998-how-to-fetch-unique-names-from-columns/#findComment-1440050 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.