Welcome Guest, Not a member yet? Register   Sign In
How to Get Count in single query.
#1

[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.
#2

[eluser]toopay[/eluser]
Learn more about count and sum statement on SQL, here the reference : http://dev.mysql.com/doc/refman/5.0/en/g...tions.html




Theme © iAndrew 2016 - Forum software by © MyBB