Showing posts with label produce. Show all posts
Showing posts with label produce. Show all posts

Saturday, February 25, 2012

Problem with PIVOT

I am currently trying to write a query that I can use in C# to produce a score table for MotorCycle races - as I know that using the PIVOT command you have to specify the column names.

I have 3 seperate tables - which I join to produce a table which I then try to rearrange with PIVOT as below.

SELECT Name,RaceName,Position FROM

(SELECT dbo.Rider.Name, dbo.Race.RaceName, dbo.Position.Position FROM

dbo.Rider INNER JOIN dbo.Position ON dbo.Rider.ID = dbo.Position.Rider_ID INNER JOIN dbo.Race ON dbo.Race.ID = dbo.Position.Race_ID) AS A

PIVOT(A.Name FOR A.RaceName IN ([Brands Hatch],[Silverstone])) AS P

When I try to run the query it says I have an error near FOR. I have taken the syntax from msdn and other sites.

Hopefully someone can help!!!!

Thanks!

PIVOT requires an aggregate function to be in there before the 'FOR' bit. So if you had MAX(A.Name), then you might get what you want.

Rob

Monday, February 20, 2012

problem with parameters in report url

I'm am trying to produce a report which has a parameter value in its url.
as I understand it
http://reports.server.local/Reports/Pages/Report.aspx?ItemPath=%2fdrift%2fjob_details&job_name=PAPERLESS
should produce the job_details report for the job named "PAPERLESS". but all
I get is the exact same page as I get if I use
http://reports.server.local/Reports/Pages/Report.aspx?ItemPath=%2fdrift%2fjob_details
I am using reporting servces 2005, can anyone see what I am doing wrong?
Thanks in advance
--
Message posted via SQLMonster.com
http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server-reporting/200705/1update, I found out I should have user the following url
http://reports.server.local/Reportserver/Pages/ReportViewer.aspx?%2fdrift%2fjob_details&rs%3aCommand=Render&job_navn=PAPERLESS
tvb wrote:
>I'm am trying to produce a report which has a parameter value in its url.
>as I understand it
>http://reports.server.local/Reports/Pages/Report.aspx?ItemPath=%2fdrift%2fjob_details&job_name=PAPERLESS
>should produce the job_details report for the job named "PAPERLESS". but all
>I get is the exact same page as I get if I use
>http://reports.server.local/Reports/Pages/Report.aspx?ItemPath=%2fdrift%2fjob_details
>I am using reporting servces 2005, can anyone see what I am doing wrong?
>Thanks in advance
--
Message posted via SQLMonster.com
http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server-reporting/200705/1