Discussion:
Crosstab Query don't work with SQL
(too old to reply)
Aran
2008-04-29 06:53:02 UTC
Permalink
Gi folks,
I recently upsized my back-end data base to SQL 2008 and everything works
quite good except my crosstab queries.
I think SQL doesn't has TRANSFORM Statement at all.
how should I over com this problem? does SQL has other statements to work as
crosstab query?
thanx in advance
Alex Dybenko
2008-04-29 13:35:41 UTC
Permalink
Hi,
look at Cross-Tab Reports section in sql server books online

SELECT Year,
SUM(CASE Quarter WHEN 1 THEN Amount ELSE 0 END) AS Q1,
SUM(CASE Quarter WHEN 2 THEN Amount ELSE 0 END) AS Q2,
SUM(CASE Quarter WHEN 3 THEN Amount ELSE 0 END) AS Q3,
SUM(CASE Quarter WHEN 4 THEN Amount ELSE 0 END) AS Q4
FROM Northwind.dbo.Pivot
GROUP BY Year
--
Best regards,
___________
Alex Dybenko (MVP)
http://accessblog.net
http://www.PointLtd.com
Post by Aran
Gi folks,
I recently upsized my back-end data base to SQL 2008 and everything works
quite good except my crosstab queries.
I think SQL doesn't has TRANSFORM Statement at all.
how should I over com this problem? does SQL has other statements to work as
crosstab query?
thanx in advance
Aran
2008-04-30 11:43:01 UTC
Permalink
Thanx alex butI need something like S access crosstab query to give and
automated query to be able to automatically add columns when I have a new
entry.
Post by Alex Dybenko
Hi,
look at Cross-Tab Reports section in sql server books online
SELECT Year,
SUM(CASE Quarter WHEN 1 THEN Amount ELSE 0 END) AS Q1,
SUM(CASE Quarter WHEN 2 THEN Amount ELSE 0 END) AS Q2,
SUM(CASE Quarter WHEN 3 THEN Amount ELSE 0 END) AS Q3,
SUM(CASE Quarter WHEN 4 THEN Amount ELSE 0 END) AS Q4
FROM Northwind.dbo.Pivot
GROUP BY Year
--
Best regards,
___________
Alex Dybenko (MVP)
http://accessblog.net
http://www.PointLtd.com
Post by Aran
Gi folks,
I recently upsized my back-end data base to SQL 2008 and everything works
quite good except my crosstab queries.
I think SQL doesn't has TRANSFORM Statement at all.
how should I over com this problem? does SQL has other statements to work as
crosstab query?
thanx in advance
Alex Dybenko
2008-05-01 04:28:40 UTC
Permalink
Sorry, no such queries in SQL server. but you can use some SP to do so, just
google for it:
http://www.google.com/search?sourceid=navclient&ie=UTF-8&&q=crosstab+stored+procedure
--
Best regards,
___________
Alex Dybenko (MVP)
http://accessblog.net
http://www.PointLtd.com
Post by Aran
Thanx alex butI need something like S access crosstab query to give and
automated query to be able to automatically add columns when I have a new
entry.
Post by Alex Dybenko
Hi,
look at Cross-Tab Reports section in sql server books online
SELECT Year,
SUM(CASE Quarter WHEN 1 THEN Amount ELSE 0 END) AS Q1,
SUM(CASE Quarter WHEN 2 THEN Amount ELSE 0 END) AS Q2,
SUM(CASE Quarter WHEN 3 THEN Amount ELSE 0 END) AS Q3,
SUM(CASE Quarter WHEN 4 THEN Amount ELSE 0 END) AS Q4
FROM Northwind.dbo.Pivot
GROUP BY Year
--
Best regards,
___________
Alex Dybenko (MVP)
http://accessblog.net
http://www.PointLtd.com
Post by Aran
Gi folks,
I recently upsized my back-end data base to SQL 2008 and everything works
quite good except my crosstab queries.
I think SQL doesn't has TRANSFORM Statement at all.
how should I over com this problem? does SQL has other statements to
work
as
crosstab query?
thanx in advance
Loading...