![]() |
How to Get Count in single query. - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: How to Get Count in single query. (/showthread.php?tid=41642) |
How to Get Count in single query. - El Forum - 05-13-2011 [eluser]Sudz[/eluser] Hi my table structure is like this table 'transacttion' ------------------- id | status | amount -------------------- 1 | fail | 50 2 | success | 100 3 | fail | 50 4 | pending | 100 5 | fail | 50 6 | success | 100 I want get Count of fail transaction,success transaction,and total amount of particular status How should i get it in single query plese anyone help. I want to display report like this ---------------------------------- |success|fail|pending ----------------------------------- Total records |2 |3 | 1 ----------------------------------- Total Amount | 200 |150 |100 ------------------------------------ Please anyone. How to Get Count in single query. - El Forum - 05-13-2011 [eluser]toopay[/eluser] Learn more about count and sum statement on SQL, here the reference : http://dev.mysql.com/doc/refman/5.0/en/group-by-functions.html |