SELECT id FROM lm_car_brand WHERE id IN (SELECT brand_id FROM lm_car_area_brand WHERE area_id = 1) AND del_status = 0 AND brand
LIKE '%?%'
String content = "内容";
listSql(sql.toString(), new Object[]{
content })
上述sql中like写法并不能使占位符生效
解决如下:
SELECT id FROM lm_car_brand WHERE id IN (SELECT brand_id FROM lm_car_area_brand WHERE area_id = 1) AND del_status = 0 AND brand
LIKE ?
String content = "内容";
content = "%" + content + "%";
listSql(sql.toString(), new Object[]{
content })