模糊搜索,bay字段是 numeric 类型的(如果是 varchar 类型的用常规的即可)
1,SELECT * FROM s_view_monitor_result WHERE bay ~~ CAST('3' as NUMERIC)
2,SELECT * FROM s_view_monitor_result WHERE bay LIKE '%3%'
3,SELECT * FROM s_view_monitor_result WHERE CAST( bay as VARCHAR) LIKE '%3%'
4,SELECT * FROM s_view_monitor_result WHERE bay::VARCHAR LIKE '%3%'
其中,1,2条语句不能成功
3,4条可以,双冒号的作用和 cast 函数一样:类型转换