第一次使用sql语句查询带有_符号的内容时:
select a.* from attribute a where a.name = 'server.other.hostName' and a.value like '%_%'
发现查询的结果是全部的结果,与预期的结果不同,后来发现like语句中_符号是代表任意字符的意思,可使用scape关键字进行查询:
select a.* from attribute a where a.name = 'server.other.hostName' and a.value like '%|_%' escape '|'
这次得到的结果就是正确的