Prova questo:
SELECT camps.id,camps.bid FROM camps c JOIN tran t ON c.user_id=t.user_id
HAVING SUM (CASE WHEN tran.status=1 THEN tran.amount ELSE 0 END)
> SUM(CASE WHEN camp.status= 1 THEN camps.expense ELSE 0 END)
Prova questo:
SELECT camps.id,camps.bid FROM camps c JOIN tran t ON c.user_id=t.user_id
HAVING SUM (CASE WHEN tran.status=1 THEN tran.amount ELSE 0 END)
> SUM(CASE WHEN camp.status= 1 THEN camps.expense ELSE 0 END)