|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Tuesday, March 05, 2013 9:30 AM
Points: 1,
Visits: 6
|
|
Hi,
Following is the script for table creation. Data for the table is attached already in Excel file named Data.xls 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 category FROM Account WHERE ServiceCode='140101' group by servicename,POType Like this: Servicename Total Accounts Category Savings Account 349 HO Savings Account 296 SO I need information in the following format Servicename HO SO Savings 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
|
|
|
|