因此,我有一条insert语句,在设置number1和number2列之前,我需要检查另一个表。我在insert语句的values部分使用了case when语句。在设置这两个列时,有没有更好的方法来做到这一点而不重复代码。INTO history ( ,number1 ) 'user1' WHEN) IS NOT NUL
有一个表,我想在其中计算所有内容,但是当canceldate (它是一个带有日期的列)为null时,@currentdate (也就是一个参数)应该在startdate和enddate之间。否则,@currentdate应该在startdate和canceldate之间。 以下是我的代码,但我仍然不知道该如何构建它。declare @currentdate as date
where
case when Canceldate is null then
我正在将一个CASE语句和子select语句放在多个WHEN子句中,用于检查null。我希望相应的THEN子句显示子选择返回的内容。是否可以在THEN子句中引用WHEN子句的子select返回结果?SELECT CASE WHEN (SELECT MAX(Column1) FROM Table1) IS NOT NULL
THEN [display the result]WHEN (SELE