2
在这里,我无法将布尔值转换为postgre sql查询中的字符。PostgreSql +布尔类型转换为字符类型
SELECT *FROM ltl_class_nmfc_aliases
WHERE ltl_class_nmfc_aliases.id
NOT IN(SELECT ltl_class_nmfc_aliases_id FROM commodities_shippeds
WHERE commodities_shipped_obj_type LIKE 'ClientOffice')
OR ltl_class_id IS NULL
AND lower(commodity_description_alias) LIKE E'%%'
AND lower(ltl_value) LIKE E'%92.5%'
AND hazardous :: integer LIKE E '%%'
AND cast(schedule_b as character varying(255)) LIKE E'%%'
AND cast(harmonized_tariff as character varying(255)) LIKE E'%%'
ORDER BY commodity_description_alias,ltl_value LIMIT 25;
在这里,我无法在AND hazardous :: integer LIKE E '%%'
到类型转换建议我如何做类型转换?
我想在我的情况下,但我没有得到任何成功。我现在要尝试你的代码。 – Rubyist 2010-10-14 12:32:12
SELECT * FROM ltl_class_nmfc_aliases LEFT OUTER JOIN ltl_class_nmfcs ON ltl_class_nmfcs.id = ltl_class_nmfc_aliases.ltl_class_nmfc_id LEFT OUTER JOIN ltl_classes ON ltl_classes.id = ltl_class_nmfcs.ltl_class_id WHERE ltl_class_nmfc_aliases.id NOT IN(SELECT ltl_class_nmfc_aliases_id FROM commodities_shippeds WHERE commodities_shipped_obj_type LIKE 'ClientOffice')OR ltl_class_id IS NULL and lower(commodity_description_alias)LIKE E'%%'AND lower(ltl_value)LIKE E'%92.5%'AND case when hazardous then'True'else'False'end and cast(schedule_b as character varying(255))LIKE E '%%'; – Rubyist 2010-10-14 12:34:48
错误:AND的参数必须是类型布尔值,而不是在where子句中输入文本 – Rubyist 2010-10-14 12:35:21