Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有两张桌子,它们之间有一个“联合”。
我的问题,我得到一个数据不匹配错误原因,在表一中我有select ... ,'opt' as opt from...然后在第二个表中我有select ..., null as opt from...
select ... ,'opt' as opt from...
select ..., null as opt from...
我知道我可以有一个空字符串,'' as opt但是我不想要一个空字符串,我真的需要它为空。无论如何我可以让查询接受空值吗?
'' as opt
解析器在内部将数据类型分配给 NULL,它是 INTEGER。您的列不是数字,因此导致 sa 类型不匹配。
简单地解决这个问题CAST(NULL AS VARCHAR(..))
CAST(NULL AS VARCHAR(..))