当前位置: 动力学知识库 > 问答 > 编程问答 >

mysql - What is query in my sql to delete multiple records?

问题描述:

//this is my query for single deletion of record.

public void deleteEmpDetails(int emp_Id){

String sql="delete from EmpDetails where emp_Id="+emp_Id;

JdbcTemplate jdbcTemplate=new JdbcTemplate(dataSource);

jdbcTemplate.update(sql);

}

Will u please tell me wat is query for multiple rows deletion.Please give me the solution.

网友答案:
delete from EmpDetails where emp_Id in (1, 2, ...)
网友答案:

Try this Code,

  public void deleteEmpDetails(int emp_Id){
         String sql="delete from EmpDetails where emp_Id IN "+emp_Id;
         JdbcTemplate jdbcTemplate=new JdbcTemplate(dataSource);
         jdbcTemplate.update(sql);
  } 
分享给朋友:
您可能感兴趣的文章:
随机阅读: