Click here to Skip to main content
15,893,588 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi i am new to crystal report . Actually i am display all details by using below query but i want to display only for particular id or particular person help me by modifing below query

SQL
Declare @year varchar(max)=''
 SELECT
       @year= Stuff((SELECT ', [' + cast(s as varchar(max))+']'
        FROM
        (SELECT DISTINCT DATEPART(YYYY,Sdate) as s FROM  dbo.StudDet
         ) x
        For XML PATH ('')),1,1,'')

exec('select Months,'+@year+'
from
(
  select cast(DATEPART(MONTH,Sdate) as varchar(max)) as Months,Score,
  DATEPART(year,Sdate) as st
  from dbo.StudDet
) x
pivot
(
  max(Score)
  for st in('+@year+')
)p ')
Posted
Updated 22-Feb-13 3:14am
v2

1 solution

You need to add a WHERE clause to your sql e.g.
...
FROM dbo.StudDet
WHERE ID=@inputID

Note that I've had a guess at the column name for the id and assumed that you're passing in the required ID in @inputId
 
Share this answer
 
Comments
Member 9846414 25-Feb-13 2:49am    
thank u very much

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900