PC Review


Reply
Thread Tools Rate Thread

Crosstab Query in ASP.Net Page

 
 
j.t.w
Guest
Posts: n/a
 
      25th Jan 2008
Hi.

Is there a way to display the results of a crosstab query in some
control on an ASP.Net web form?

I think my first problem is that this query only works in Access and
not via the SQL Query Analyzer or the DataSource wizzard in VWD2005EE.

TRANSFORM Sum([q1].sls_amt) AS SumOfsls_amt
SELECT [q1].prod_cat, Sum([q1].sls_amt) AS [Total Of sls_amt]
FROM (SELECT OEHDRHST_SQL.slspsn_no, OELINHST_SQL.prod_cat,
OELINHST_SQL.sls_amt
FROM OEHDRHST_SQL INNER JOIN OELINHST_SQL ON OEHDRHST_SQL.ord_no =
OELINHST_SQL.ord_no
WHERE OEHDRHST_SQL.inv_dt BETWEEN 20080101 AND 20080131
ORDER BY OEHDRHST_SQL.slspsn_no, OELINHST_SQL.prod_cat) AS q1
GROUP BY [q1].prod_cat
PIVOT [q1].slspsn_no;

Does anyone know or have the correct syntax for a crosstab or pivot
query in SQL Server 2000?

Secondly, if and when I get the query running, what control do I use
to display the results?

Thanks in advance for any and all help.
j.t.w
 
Reply With Quote
 
 
 
 
Mark Rae [MVP]
Guest
Posts: n/a
 
      25th Jan 2008
"j.t.w" <(E-Mail Removed)> wrote in message
news:baf1493d-5837-410b-9d06-(E-Mail Removed)...

> Does anyone know or have the correct syntax for a crosstab or pivot
> query in SQL Server 2000?


http://www.google.co.uk/search?sourc...00%22+crosstab

> Secondly, if and when I get the query running, what control do I use
> to display the results?


GridView


--
Mark Rae
ASP.NET MVP
http://www.markrae.net

 
Reply With Quote
 
j.t.w
Guest
Posts: n/a
 
      5th Feb 2008
Mark,

Sorry for not getting back to you earlier.

It took me a while to figure it out but it works.

Thank you for your help.
j.t.w
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Crosstab query is no longer crosstab when I include field (in repo Ben8765 Microsoft Access Reports 1 15th Oct 2009 10:01 PM
Crosstab query - want report to look like crosstab alison.justice Microsoft Access Queries 1 31st May 2009 05:35 AM
Crosstab form based on Crosstab query? Penny Microsoft Access Forms 1 31st Mar 2006 07:36 PM
Crosstab query with criteria, dynamic columns and crosstab report question joshblair Microsoft Access Queries 5 13th Jan 2006 09:34 PM
Form input in query, Union and crosstab query gives error msg Christian Microsoft Access Queries 2 17th Nov 2004 05:00 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:08 PM.