String sqlStr2="delete from permission where Perm_id in(select Perm_id from roleperm where Role_id in (select Role_id from role where Role_name = '"+comboBox_2.getSelectedItem().toString()+"'))";这是我写程序用到的一条删除语句,Perm_id返回的是2个值,用delete from好像不行,请教一下有什么方法解决伐?最好还是用一条语句。 谢谢!

解决方案 »

  1.   

    delete permission  from permission a join roleperm b on a.Perm_id=b.Perm_id join role c on b. Role_id = c.Role_id 
    where c.Role_name  = '"+comboBox_2.getSelectedItem().toString()+"'
      

  2.   

    See the multiple delete syntax on the document.
      

  3.   

    String sqlStr2="delete from permission where Perm_id in(select Perm_id from roleperm where Role_id in (select Role_id from role where Role_name = '"+comboBox_2.getSelectedItem().toString()+"'))"; 
    在后面加个limit 0,1试一下