我自己写了一个 Sql.text := 'select * from table1 where XX like qute('%' + str1 +'%') union 'select * from table1 where XX like qute('%' + str2 +'%') union 'select * from table1 where XX like qute('%' + str1 +'%')'; 可是查询的时候 总提示 '内存溢出' (字段里面没有日文片假名之类的字符)
用OR连接条件:select * from table1 where (XX like '%11%) OR (XX like '%22%)
我觉得应该不是 union 或 or 的问题
Sql.text := 'select * from table1 where XX like ''%' + quotedstr(str1) +'%''' + ' or XX like ''%' + quotedstr(str2) +'%''' + ' or XX like ''%' + quotedstr(str3) +'%'''
select a,b,c from table where ((a like '%'+'+trim(RzComboBox72.Text)+'+'%') OR (b like '%'+'+trim(RzComboBox72.Text)+'+'%') OR (c like '%'+'+trim(RzComboBox72.Text)+'+'%')) ........
可是查询的时候 总提示 '内存溢出' (字段里面没有日文片假名之类的字符)
' or XX like ''%' + quotedstr(str2) +'%''' +
' or XX like ''%' + quotedstr(str3) +'%'''
((a like '%'+'+trim(RzComboBox72.Text)+'+'%') OR
(b like '%'+'+trim(RzComboBox72.Text)+'+'%') OR
(c like '%'+'+trim(RzComboBox72.Text)+'+'%'))
........