﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 2008 / SQL Server 2008 - General  / QUERY HELP / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Fri, 24 May 2013 19:12:51 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: QUERY HELP</title><link>http://www.sqlservercentral.com/Forums/Topic1398947-391-1.aspx</link><description>THANKS MEN!</description><pubDate>Thu, 20 Dec 2012 07:01:04 GMT</pubDate><dc:creator>davdam8</dc:creator></item><item><title>RE: QUERY HELP</title><link>http://www.sqlservercentral.com/Forums/Topic1398947-391-1.aspx</link><description>Use a CASE expression in your SUM statement, something like this:[quote]...SUM(CASE WHEN Year = 2010 THEN Amount ELSE 0 END) AS Total2010,SUM(CASE WHEN Year = 2011 THEN Amount ELSE 0 END) AS Total2011...[/quote]Alternatively, you could use PIVOT.  Or you could write a report in Reporting Services to display your data in the way you need.John</description><pubDate>Thu, 20 Dec 2012 06:52:25 GMT</pubDate><dc:creator>John Mitchell-245523</dc:creator></item><item><title>QUERY HELP</title><link>http://www.sqlservercentral.com/Forums/Topic1398947-391-1.aspx</link><description>Hi geniuses!I have this query[code="xml"]SELECT DISTINCT chapter,  Sum(dbo.FGG.Value) AS FGG2010FROM FGG WHERE (FGG.YEAR= 2010) and (dbo.FGG.valueType = '02 - FGG01l') Group by chapter[/code]It retrieves :                                    chapter | FGG2010    A     |  1$       B     |  2$    C     |  3$What I want is to add in 'Sum(dbo.FGG.Value) AS FGG2011' where FGG.YEAR=2011 in the same query, in order to retrive:chapter | FGG2010 | FGG2011    A     |  1$         | 2$    B     |  2$         | 33$    C     |  3$         | 11$Thanks in advance!Regards</description><pubDate>Thu, 20 Dec 2012 06:39:56 GMT</pubDate><dc:creator>davdam8</dc:creator></item></channel></rss>