Hi
i have select statement
SELECT accounts.account,account_name_arabic, accounts.account_name_english, sum(recieptvoucher.reciept_amount) as Debit, sum(recieptvoucher.pay_amount) as Credit,(sum(recieptvoucher.reciept_amount)-sum(recieptvoucher.pay_amount)) as Dues FROM recieptvoucher INNER JOIN accounts ON recieptvoucher.account_id = accounts.account where accounts.parent_account=123 group by accounts.account,account_name_arabic, accounts.account_name_english order by accounts.account_name_english
i want to select data where sum(recieptvoucher.reciept_amount)-sum(recieptvoucher.pay_amount))<>0
i tried this statement
SELECT accounts.account,account_name_arabic, accounts.account_name_english, sum(recieptvoucher.reciept_amount) as Debit, sum(recieptvoucher.pay_amount) as Credit,(sum(recieptvoucher.reciept_amount)-sum(recieptvoucher.pay_amount)) as Dues FROM recieptvoucher INNER JOIN accounts ON recieptvoucher.account_id = accounts.account where accounts.parent_account=123 and (sum(recieptvoucher.reciept_amount)-sum(recieptvoucher.pay_amount))<>0 group by accounts.account,account_name_arabic, accounts.account_name_english order by accounts.account_name_english
but it give errror
Additional information: An aggregate may not appear in the WHERE clause unless it is in a subquery contained in a HAVING clause or a select list, and the column being aggregated is an outer reference.
Thanks