Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 select within case

Author  Topic 

akpaga
Constraint Violating Yak Guru

331 Posts

Posted - 2009-02-13 : 17:06:35
hi
i want use select statement
with in a case statement.


case when year ='2009'

then select ----- from table 1

else


select-------- from table 2



what is the syntax for this query.

thanks

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-02-13 : 17:08:05
You would use an IF statement instead of CASE.

But if you show us your actual queries, we could probably come up with a better and more efficient solution.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -