Is there a SQL version of a Crosstab Query??Is there a SQL version of a Crosstab Query??
Not in SQL 7.0 or SQL 2000. SQL 2005 has PIVOT which is similar (but I don't know the full syntax).
There are also 3rd party products that you can install that will simulate a crosstab. You can search for AGS Crosstab or RAC for SQL.
Regards,
hmscott|||Thank you very much :)|||You can create a static crosstab query in SQL fairly easily using CASE statements. For an excellent explanation and example, just look up CROSSTAB in books online.
Note that this method will not produce dynamic crosstabs with variable column headers, but you really shouldn't be doing that in the first place.|||In a project I'm doing, there are crosstab queries in Access that have to be replicated in SQL via a stored procedure or else they'll take forever to run. The columns are fixed so I used a sproc to create a temp table, insert the data into it, aggregate it, then present it. It looks exactly like the old Access crosstab and executes more quickly, but it's not very flexible. Works for us though.|||...The columns are fixed so I used a sproc to create a temp table, insert the data into it, aggregate it, then present it..You would probably get better efficiency by droppint the temp table method and using the CASE method recommended in Books Online.|||You would probably get better efficiency by droppint the temp table method and using the CASE method recommended in Books Online.
CASE statements aren't overly popular around here. We're switching to SQL Server 2005 soon so I'm anxious to get my hands on the new PIVOT functionality. :beer:|||CASE statements aren't overly popular around here. We're switching to SQL Server 2005 soon so I'm anxious to get my hands on the new PIVOT functionality. :beer:
OK. I will bite. Why?|||CASE statements aren't overly popular around here. Are you writing code, or are you electing the Senior Class President?|||This is cool you guys are still replying to this. How are you guys doing anyways, Ive been busy creating a website|||This is cool you guys are still replying to this. How are you guys doing anyways, Ive been busy creating a website...and you didn't post the URL? How do you expect to pop up to the top of the search engines?|||Hey there long time no see how you been
the site isnt done yet|||hey does anyone know of a good graphics software, something nice but not too hard to use|||You're asking database coders about graphics?
This is about as far as you could go with SQL:
http://www.chris.com/ascii/index.html|||sorry bad question, I'll ask else where
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment