-3
這是我目前正在使用的查詢,但我沒有得到 的預期輸出。如何在Mysql中獲取列的唯一標識符和組的唯一標識符?
SELECT u.user_id, u.email, SUM(ca.credits_added) as credits_added, SUM(cs.credits_spent) as credits_spent
FROM weg_whitehound.users u
JOIN weg_whitehound.credits_added ca
ON u.user_id = ca.user_id
JOIN weg_whitehound.credits_spent cs
ON u.user_id = cs.user_id
GROUP BY ca.user_id
和我的原始數據庫here
張貼適當的DDL(和/或sqlfiddle)連同所需的結果集。 – Strawberry