これにより、外部資金を使用したユーザーのリストが表示されます。
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
、空のセットが得られます。外部資金を使用していないユーザーが何千人もいることがわかっています。