Crosstab Query in ASP.Net Page

Crosstab Query in ASP.Net Page

am 25.01.2008 02:19:06 von j.t.w

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

Re: Crosstab Query in ASP.Net Page

am 25.01.2008 02:48:53 von mark

"j.t.w" wrote in message
news:baf1493d-5837-410b-9d06-fe11b42c2adc@s19g2000prg.google groups.com...

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

http://www.google.co.uk/search?sourceid=navclient&hl=en-GB&i e=UTF-8&rlz=1T4GZEZ_en-GBGB252GB252&q=%22SQL+Server+2000%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