Baselight
SELECT
    to_team.country AS country,
    SUM(t.transfer_fee_eur) AS total_spent_eur,
    SUM(CASE 
            WHEN from_team.country = to_team.country THEN t.transfer_fee_eur 
            ELSE 0 
        END) AS domestic_spent_eur,
    SUM(CASE 
            WHEN from_team.country != to_team.country THEN t.transfer_fee_eur 
            ELSE 0 
        END) AS international_spent_eur,
    COUNT(*) AS number_of_transfers
FROM
    @blt.ultimate_soccer_dataset.transfers AS t
JOIN
    @blt.ultimate_soccer_dataset.teams AS to_team
    ON t.to_team_id = to_team.team_id
LEFT JOIN
    @blt.ultimate_soccer_dataset.teams AS from_team
    ON t.from_team_id = from_team.team_id
WHERE
    t.transfer_fee_eur IS NOT NULL
    AND to_team.country IN ('England', 'Spain', 'Italy', 'Germany', 'France')
    AND EXTRACT(YEAR FROM t.transfer_date) = 2024
GROUP BY
    to_team.country
ORDER BY
    total_spent_eur DESC
countrytotal_spent_eurdomestic_spent_eurinternational_spent_eurnumber_of_transfers
England2586184200119938300012924842003602
Italy10309900005025600004882600001642
France9592570002402045006840525002035
Germany6770500002165150004482850001177
Spain6337900001544400004531000003338

Share link

Anyone who has the link will be able to view this.