[英]How to use a select statment inside a case statement
I will do a select statement inside my case statement like this: 我将在我的case语句中做一个select语句,如下所示:
CASE
WHEN d.dependent_speed_type = 4 THEN (SELECT column FROM tablename)
END
But this is not working. 但这是行不通的。 Can I realize a select statement inside my case statement?
我可以在case语句中实现选择语句吗? If the value 4 is inside my column "d.dependent_speed_type" then it should be select a special value from another table.
如果值4在我的列“ d.dependent_speed_type”内,则应从另一个表中选择一个特殊值。 How is the right syntax?
正确的语法如何?
您必须使用总是返回一个值的东西,例如SELECT MAX(column) FROM tablename)
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.