By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,709 Members | 2,164 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,709 IT Pros & Developers. It's quick & easy.

Pivot Table

P: n/a
Does anyone know of a site outlining a good method of implementing a Pivot
table style grid using aGridView control or similar?
Aug 15 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
HI

We had a requirement to display summary information in a pivot table so
created a cross-tab query and used that as the datasource.

This is based on a table containing information on MCMS templates but
the logic can be applied to any table

CREATE PROCEDURE dbo.sp_GetPostingSummaryInfoByServiceArea
(
@StartDateAsString varchar(30),
@FinishDateAsString varchar(30),
@ServiceArea varchar(10)
)

AS

IF @StartDateAsString = '' SET @StartDateAsString = '01/01/1950
00:00:00'
IF @FinishDateAsString = '' SET @FinishDateAsString = '31/12/9999
23:59:59'
IF @ServiceArea = '' SET @ServiceArea = '%'

SELECT auth_serv_area,
count(CASE posting_state WHEN 1 then posting_state end) AS Saved,
count(CASE posting_state WHEN 2 then posting_state end) AS
Ed_Approval,
count(CASE posting_state WHEN 3 then posting_state end) AS
Editor_Dec,
count(CASE posting_state WHEN 4 then posting_state end) AS Mod_App,

count(CASE posting_state WHEN 5 then posting_state end) AS Modr_Dec,

count(CASE posting_state WHEN 6 then posting_state end) AS Approved,

count(CASE posting_state WHEN 7 then posting_state end) AS Published,
count(CASE posting_state WHEN 1 then posting_state end) +
count(CASE posting_state WHEN 2 then posting_state end) +
count(CASE posting_state WHEN 3 then posting_state end) +
count(CASE posting_state WHEN 4 then posting_state end) +
count(CASE posting_state WHEN 5 then posting_state end) +
count(CASE posting_state WHEN 6 then posting_state end) +
count(CASE posting_state WHEN 7 then posting_state end) as
ServiceTotal,
count(CASE HasLiveVersion WHEN 'True' then HasLiveVersion end) as
PostWtLiveVer
FROM postings
where (@StartDateAsString <= last_modified) and
(@FinishDateAsString >= last_modified) and
(auth_serv_area like @ServiceArea)
GROUP BY auth_serv_area
order by auth_serv_area
GO

Mikey
clickon wrote:
Does anyone know of a site outlining a good method of implementing a Pivot
table style grid using aGridView control or similar?
Aug 15 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.