﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / Article Discussions / Discuss content posted by Mohit Nayyar / Article Discussions by Author  / How to combine group of data in One / 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 20:07:18 GMT</lastBuildDate><ttl>20</ttl><item><title>How to combine group of data in One</title><link>http://www.sqlservercentral.com/Forums/Topic836149-613-1.aspx</link><description>Hi, Following is the script for table creation. Data for the table is attached already in Excel file named [b]Data.xls[/b] CREATE TABLE [dbo].[Account] ( [ServiceCode] [varchar] (100) NOT NULL , [ServiceName] [varchar] (100) NOT NULL , [AccountNo] [nvarchar] (30) NOT NULL , [POCode] [numeric](18, 0) NOT NULL , [POType] [numeric](18, 0) NOT NULL ,) ON [PRIMARY]Following query will display data SELECT servicename, count(accountNo) As [Total Accounts],    case POtype When 1 then 'HO' else 'SO'   end as categoryFROM Account WHERE ServiceCode='140101'group by servicename,POType  Like this:Servicename             Total Accounts     CategorySavings Account            349                    HO Savings Account            296                    SO  I need information in the following format Servicename                HO                 SOSavings Account          349                296  Is it possible with simple SQL or stored procedure is required? If it is possible using standard SQL, then that will be preferred.Thanks</description><pubDate>Fri, 18 Dec 2009 00:22:03 GMT</pubDate><dc:creator>Wahaj Khan</dc:creator></item></channel></rss>