这给了我一个使用外部资金的用户列表。
SELECT
table_user.user as user,
sum(table_deposit.amount) as TotalExternalDeposits,payby,pro_id
FROM table_deposit inner join table_user on table_deposit.user = table_user.user
WHERE table_deposit.pro_id <> 'Cash A/C'
AND table_deposit.batch NOT LIKE '%adj%'
AND table_deposit.batch NOT LIKE 'Xmas%'
AND table_deposit.batch NOT LIKE 'X-mas%'
group by table_user.user
order by table_user.user
我的问题是现在我需要一份未使用外部资金的用户列表 ( TotalExternalDeposits = 0
)。我迷路了。
当我尝试添加类似以下内容时:HAVING TotalExternalDeposits = 0
我得到一个空集。我知道有成千上万的用户没有使用外部资金。