General information
Forum:
Microsoft SQL Server
Environment versions
SQL Server:
SQL Server 2005
I used the following.
DECLARE @StdLevel TABLE (StidenId int, Level int)
INSERT INTO @StdLevel
SELECT StudentId, MAX(Level)
FROM (SELECT StudentId, 1 AS Level
FROM Level1
UNION ALL
SELECT StudentId, 2 AS Level
FROM Level2
UNION ALL
SELECT StudentId, 3 AS Level
FROM Level3
UNION ALL
SELECT StudentId, 4 AS Level
FROM Level4
UNION ALL
SELECT StudentId, 5 AS Level
FROM Level5) Levels
GROUP BY StudentId
SELECT .....
FROM ...
INNER JOIN @StdLevel S
Thanks Again
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only