Click here to Skip to main content
11,636,213 members (76,470 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# SQL WindowsForms
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

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 21-Feb-13 23:53pm
Edited 22-Feb-13 3:14am
CHill60102.1K
v2

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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
  Permalink  
Comments
Member 9846414 at 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)

  Print Answers RSS
0 jyo.net 295
1 Sergey Alexandrovich Kryukov 275
2 OriginalGriff 233
3 Suvendu Shekhar Giri 225
4 stibee 215
0 OriginalGriff 8,941
1 Sergey Alexandrovich Kryukov 8,459
2 Mika Wendelius 6,849
3 F-ES Sitecore 2,364
4 Suvendu Shekhar Giri 2,320


Advertise | Privacy | Mobile
Web01 | 2.8.150728.1 | Last Updated 22 Feb 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100