Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Statement How To
Message
From
17/06/2009 17:05:49
 
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Environment versions
SQL Server:
SQL Server 2005
Application:
Desktop
Miscellaneous
Thread ID:
01404764
Message ID:
01406757
Views:
31
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
Map
View

Click here to load this message in the networking platform