i write a my sql query
select sum(amount) as totalAmount from employee_account where id = 29967 and repayment_status in ("MARKEDPAID", "PAID", "PENDING", "OVERDUE");
This query is working fine in mysql console. I have to execute this query in java using
String query = ""
int id = 123
Connection connection = // connection code
Statement statement = connection.createStatement()
ResultSet resultSet = statement.executeQuery(query)
I write the
query = "select sum(amount) as totalAmount from employee_account where id = ${id} and repayment_status in ()"
How i pass "MARKEDPAID", "PAID", "PENDING", "OVERDUE" in above String query?
String status = "\'OVERDUE\',\'PAID\',\'PENDING\',\'MARKEDPAID\'"
String query = "select sum(amount) as totalAmount from employee_account where id = ${id} and repayment_status in (${status})"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.