1
我想检查posgtres查询,在我的表中的情况下两个条件一个字段可能有两个值或者将为空或将单引号('')所以我尝试此查询,但没有执行空栏或空字段检查在rails中的postgres查询
CASE WHEN (items.item_code is NULL OR items.item_code = '') THEN
items.name::text ELSE items.item_code::text END as item_code
错误,如:
PG::Error: ERROR: syntax error at or near ")" LINE 1: ...HEN (items.item_code is NULL OR items.item_code =) THEN ite..
“空或单引号”,你的意思是'NULL'或空字符串?因为单引号是完全不同的东西。 – sagi
“它没有执行”;什么是错误? – Marth
错误,如PG ::错误:错误:语法错误在或接近“)” LINE 1:... HEN(items.item_code为NULL或items.item_code =)然后... – amtest