if条件为什么不能加括号
这个SQL语句
if exists (select * from table1) select * from table2
可以执行但是加上括号就不可以用了
(if exists (select * from table1) select * from table2)
提示错误如下
Server: Msg 156, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'if'.
Server: Msg 170, Level 15, State 1, Line 3
Line 3: Incorrect syntax near ')'.
要怎么解决,我这个条件是放在where条件后面的需要添加这个括号。请问有什么办法解决?