java - Getting records from database with variable condition -
i'm trying lists of records id
in specific set. set application via web service. should write query this: select * tbl_data id in (?, ?, ?, ?)
. problem (?, ?, ?, ?)
part variable length. 1 request like: select * tbl_data id in (?, ?, ?)
, like: select * tbl_data id in (?, ?, ?, ?, ?, ?)
. don't loop , records 1 one. there way build query?
you can generate in
part of query in code. if know should instead of ? symbol
, run loop , build it.
string sqlpart = "("; (every symbol last){ sqlpart += symbol; sqlpart += ","; } sqlpart += lastsymbol; sqlpart += ")"; string sql = "select * tbl_data id in " + sqlpart;
Comments
Post a Comment