SQL⼦查询报错syntaxerroratendofinput
SELECT dict_name FROM sys_dictionary WHERE dict_type = 'gateway' and dict_code = beg.gateway_type
这⼀条作为⼦查询时出现syntax error at end of input错误
syntaxerror是什么错误百度⼀下是因为参数为空导致的, beg.gateway_type这个是左连接的右表, 所以的确可能为空.
于是我加了⼀个判断, 改为:
CASE WHEN gateway_type is not null THEN (SELECT dict_name FROM sys_dictionary WHERE dict_type = 'gateway' and dict_code = beg.gateway_type) ELSE null END as gateway_typename
就好了