November 25, 2011 at 4:59 am
dear All
I am new in sqlserver 2005 I Have an one doubt for finding the Values in Particular column .
RegisterNo CourseID ExtMark
080510400108027 96
080510401108027 96
080510401608027 96
080510401908027 96
080510403308027 96
080510404108027 96
080510404608027 96
080510404708027 96
080510405708027 96
080510407308027 96
080510408508027 96
080510409508027 96
080510470108027 96
I want to fetch the record for same sequence registerno like
0805104046,0805104047) Having 96 Mark For the courseid containing 08027
Any one Help me to find out the solution for solving the problem.
November 25, 2011 at 5:36 am
Im kinda new to sqlserver myself, but this kinda worked for me
SELECT DISTINCT [yourtable].[RegisterNo] FROM [yourtable] INNER JOIN [yourtable] as [yourtable2] ON [yourtable].[RegisterNo] =[yourtable2].[RegisterNo]+1 WHERE [yourtable].[CourseID]=08027 AND [yourtable].[ExtMark]=96
UNION
SELECT DISTINCT [yourtable].[RegisterNo]-1 FROM [yourtable] INNER JOIN [yourtable] as [yourtable2] ON [yourtable].[RegisterNo] =[yourtable2].[RegisterNo]+1 WHERE [yourtable].[CourseID]=08027 AND [yourtable].[ExtMark]=96
ORDER BY [RegisterNo] ASC
November 27, 2011 at 9:51 pm
select registerNo,CourseID,ExtMark from table where Extmark=96 order by RegisterNo
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply