﻿<?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  / Retrieve Data with condition / 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>Tue, 21 May 2013 21:27:38 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Retrieve Data with condition</title><link>http://www.sqlservercentral.com/Forums/Topic1381003-391-1.aspx</link><description>Try this, unpivot logic:CREATE TABLE #Amt(Id INT, Monthly Float,Quaterly Float,HealfYearly Float,Yearly Float)INSERT INTO #Amt (Id ,Monthly ,Quaterly ,HealfYearly ,Yearly )VALUES (1,100,200,400,800),(2,200,400,600,900)--SELECT * FROM #Amt	SELECT ID, PaymentTerm, Amount	FROM	(	SELECT Id ,Monthly ,Quaterly ,HealfYearly ,Yearly FROM #Amt	) p	UNPIVOT	(Amount FOR PaymentTerm IN		(		Monthly,		Quaterly,		HealfYearly,		Yearly		)	)AS unpvtDROP TABLE #Amt</description><pubDate>Mon, 05 Nov 2012 07:05:13 GMT</pubDate><dc:creator>deepkt</dc:creator></item><item><title>RE: Retrieve Data with condition</title><link>http://www.sqlservercentral.com/Forums/Topic1381003-391-1.aspx</link><description>What about[code]SELECT USERID, 'Monthly' as [PERIOD], SUM([MONTHLY] As [PERIOD_TOTAL]UNIONSELECT USERID, 'Quaterly' as [PERIOD], SUM([Quaterly] As [PERIOD_TOTAL]UNIONSELECT USERID, 'HealfYearly' as [PERIOD], SUM([HalfYearly] As [PERIOD_TOTAL]UNIONSELECT USERID, 'Yearly' as [PERIOD], SUM([Yearly] As [PERIOD_TOTAL][/code]HTH,B</description><pubDate>Mon, 05 Nov 2012 05:14:26 GMT</pubDate><dc:creator>bleroy</dc:creator></item><item><title>Retrieve Data with condition</title><link>http://www.sqlservercentral.com/Forums/Topic1381003-391-1.aspx</link><description>Hi,I have one Table Userid   Monthly Quaterly HalfYearly Yearly----------------------------------------------------1           30.00    0.00        0.00      0.002           0.00      300.00     0.00      0.00I want display the data in gridview based on above table.User PaymentTerm Amount--------------------------------Raja    Monthly      30.00Ram    Quaterly      300.00what is the query for above</description><pubDate>Mon, 05 Nov 2012 05:09:34 GMT</pubDate><dc:creator>sidharthgs6</dc:creator></item></channel></rss>