You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SELECT a.id_user, a.name, SUM(b.value)
FROM (
SELECT b.id_user_anon AS id_user, a.name
FROM user a
JOIN mapping b
ON a.id_user = b.id_user
) a
JOIN (
SELECT b.id_user_anon AS id_user, a.value
FROM order a
JOIN mapping b
ON a.id_user = b.id_user
) b
ON a.id_user = b.id_user
GROUP BY 1,2
;
Could we deduplicate join mapping twice and only join it once, like
SELECT b.id_user_anon AS id_user, a.name, SUM(b.value)
FROM (
SELECT a.id_user, a.name, b.value
FROM user a
JOIN order b
ON a.id_user = b.id_user
) a
JOIN mapping b
ON a.id_user = b.id_user
GROUP BY 1, 2
Like we've discussed in #13160
when we have a query like this:
Could we deduplicate
join mapping
twice and only join it once, likecc @findepi
The text was updated successfully, but these errors were encountered: