请参阅以下教义查询:
SELECT values, orgunit, form
FROM Values values
INNER JOIN values.orgunit orgunit
INNER JOIN values.form form
INNER JOIN orgunit.orgunitStructure orgunitStructure
WHERE orgunitStructure.level1Id=123032
AND orgunitStructure.level >= (SELECT selectedOrgSructure.level FROM OrgunitStructure selectedOrgSructure WHERE selectedOrgSructure.orgunit=123032 )
AND form.id IN(189,187,190,188)
AND (
LOWER(values.value) LIKE '%"189886":"10369434"%'
OR LOWER(values.value) LIKE '%"189880":"10369434"%'
OR LOWER(values.value) LIKE '%"189881":"10369434"%'
OR LOWER(values.value) LIKE '%"189871":"10369434"%'
OR LOWER(values.value) LIKE '%"189888":"10369434"%'
OR LOWER(values.value) LIKE '%"189873":"10369434"%'
OR LOWER(values.value) LIKE '%"189870":"10369434"%'
OR LOWER(values.value) LIKE '%"189863":"10369434"%'
OR LOWER(values.value) LIKE '%"189865":"10369434"%'
OR LOWER(values.value) LIKE '%"189867":"10369434"%'
OR LOWER(values.value) LIKE '%"189869":"10369434"%'
OR LOWER(values.value) LIKE '%"189872":"10369434"%'
OR LOWER(values.value) LIKE '%"189894":"10369434"%'
OR LOWER(values.value) LIKE '%"189896":"10369434"%'
OR LOWER(orgunit.longname) LIKE '%10369434%'
)
我正在寻找 WHERE 子句的 REGEX 优化,特别是将 OR 组合成类似的东西,来自:
LOWER(values.value) LIKE '%"189886":"10369434"%'
OR LOWER(values.value) LIKE '%"189880":"10369434"%'
OR LOWER(values.value) LIKE '%"189881":"10369434"%'
OR LOWER(values.value) LIKE '%"189871":"10369434"%'
OR LOWER(values.value) LIKE '%"189888":"10369434"%'
OR LOWER(values.value) LIKE '%"189873":"10369434"%'
OR LOWER(values.value) LIKE '%"189870":"10369434"%'
进入:
LOWER(values.value) REGEXP '%("189886":"10369434")|("189886":"10369434")|("189880":"10369434")|("189881":"10369434")|("189871":"10369434")|("189888":"10369434")|("189873":"10369434")%'