December 18, 2009 at 12:22 am
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
Viewing 0 posts
You must be logged in to reply to this topic. Login to reply