Q:

the sql query is giving me a single row using like query

Id  Account_name      Date         Debit    Credit    
1   revenue         2014-05-05    808001    555001      
2   expense         2014-05-05     48000     90000      
3   a/p             2014-05-05       800      1000       
3   a/r             2014-05-05     36000     50000        
4   rent_revenue    2014-05-05     40000     50000       

ok this is my table I want to calculate the total balance of revenue, a/rand the sql query is below given
SELECT account_name, SUM(debit)+SUM(credit) AS TOTAL BALANCE 
WHERE  account_name LIKE '%revenue%' 

The problem is that its only showing me the result of account_name='revenue' and its total balance, I want the other row as well what should I do ?

A:

I think you are looking for something like this : 
SELECT account_name ,SUM(debit)+SUM(credit) AS `TOTAL BALANCE`
FROM Tablename
WHERE account_name LIKE '%revenue%' 
GROUP BY account_name

