Currently I am running a sql script that gives result from two tables (cc_transactions and cc_transaction_status) with below query:
SELECT cc_transactions.transAmount as amt
FROM cc_transactions
INNER JOIN cc_transaction_status ON cc_transactions.id = cc_transaction_status.transaction_id
WHERE account_id = '11E5F26C8164C3BABF85F8B156B0DBF5'
GROUP BY cc_transactions.id
HAVING MAX(cc_transaction_status.sortOrder) = 0
The result is
amt
200.0000
300.0000
1000.0000
I want the result to be
amt
1500.0000
Can anyone please look in to this.
SELECT SUM(Amount.amt) from (
SELECT cc_transactions.transAmount as amt
FROM cc_transactions
INNER JOIN cc_transaction_status ON cc_transactions.id = cc_transaction_status.transaction_id
WHERE account_id = '11E5F26C8164C3BABF85F8B156B0DBF5'
GROUP BY cc_transactions.id
HAVING MAX(cc_transaction_status.sortOrder) = 0
) as Amount;
If your query run successfully then it will give sum....
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.