Torna al Thread

SELECT tutto.id_cliente, SUM(tutto.inverno) AS totale_inverno, SUM(tutto.estate) AS totale_estate, tutto.anno FROM( SELECT id_cliente, totale AS inverno, 0 AS estate, anno FROM tab_ordine WHERE inverno = true AND anno = '2007' UNION ALL SELECT id_cliente, 0, totale, anno FROM tab_ordine WHERE estate = true AND anno = '2007' ) AS tutto GROUP BY id_cliente, anno;
Copyright © dotNetHell.it 2002-2024
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5