Android 不考虑 SQLite Where 子句
Android SQLite Where Clause not considered
我创建了一个参数查询以从数据库中获取一些数据 table。一切正常,但不考虑 AND tipo = 2
。你有什么建议吗?
String sql = "SELECT titolo, icona, colore, tipo, identificativo, dato_campo FROM table " +
"WHERE titolo LIKE '%" + parametro + "%' " +
"OR dato_campo LIKE '%" + parametro + "%' AND tipo = 2 GROUP BY identificativo ORDER BY titolo ASC";
括号:
SELECT titolo, icona, colore, tipo,
identificativo, dato_campo
FROM table
WHERE
(titolo LIKE '%" + parametro + "%' "
OR
dato_campo
LIKE '%" + parametro + "%'
)
AND tipo = 2
GROUP BY identificativo ORDER BY titolo ASC";
我创建了一个参数查询以从数据库中获取一些数据 table。一切正常,但不考虑 AND tipo = 2
。你有什么建议吗?
String sql = "SELECT titolo, icona, colore, tipo, identificativo, dato_campo FROM table " +
"WHERE titolo LIKE '%" + parametro + "%' " +
"OR dato_campo LIKE '%" + parametro + "%' AND tipo = 2 GROUP BY identificativo ORDER BY titolo ASC";
括号:
SELECT titolo, icona, colore, tipo,
identificativo, dato_campo
FROM table
WHERE
(titolo LIKE '%" + parametro + "%' "
OR
dato_campo
LIKE '%" + parametro + "%'
)
AND tipo = 2
GROUP BY identificativo ORDER BY titolo ASC";