Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Statement How To
Message
 
 
To
09/06/2009 14:42:02
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Environment versions
SQL Server:
SQL Server 2005
Application:
Desktop
Miscellaneous
Thread ID:
01404764
Message ID:
01404825
Views:
45
>It's pretty complicated to say the least. I was hoping I would be able to write a statement that just checked for a students existence in each subquery. I was thinking of using ICASE but I wasn't sure if I could use that in conjunction with "Where exists ( Select * from level5)".

You can use CASE with EXISTS
CASE 
  WHEN EXISTS (Select 1 from level5) THEN 5 
  WHEN EXISTS (Select 1 from level4) THEN 4 
  ...
  ELSE 0 
END AS StudentLevel
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform