delete mail from mail,author where mail.fromid=author.id and (mail.operation='put' or mail.operation='draft') and (mail.fromid=20) and (author.usergroup like '%管理员%')

解决方案 »

  1.   

    这样都出错呢
    delete mail from mail,author where mail.userid=21
    Error: 1064 - You have an error in your SQL syntax near 'mail from mail,author where mail.userid=21' at line 1
    _____________________
    Delete语法是这样的啊
    DELETE [LOW_PRIORITY] FROM tbl_name
        [WHERE where_definition] [LIMIT rows]
    DELETE从tbl_name表中删除满足由where_definition给出的条件的行,并且返回删除记录的个数。
    _____________________
    谢谢shuixin13(犬犬(心帆)) ,但你的也出错~~~~~
      

  2.   

    DELETE [LOW_PRIORITY] [QUICK] FROM table_name
           [WHERE where_definition]
           [ORDER BY ...]
           [LIMIT rows]orDELETE [LOW_PRIORITY] [QUICK] table_name[.*] [,table_name[.*] ...]
           FROM table-references
           [WHERE where_definition]orDELETE [LOW_PRIORITY] [QUICK]
           FROM table_name[.*], [table_name[.*] ...]
           USING table-references
           [WHERE where_definition] 从 MySQL 4.0.0 开始支持第一个多表删除格式,
     第二个多表删除格式从 MySQL 4.0.2 开始支持当前最新版是 MySQL 4.0.12 它已是一个生产型的稳定版本,
    建议升级到这个版本!!!
      

  3.   

    我只有这样了
    select mail.id from mail,author where mail.fromid=author.id and (mail.operation='put' or mail.operation='draft') and (mail.fromid=20) and (author.usergroup like '%管理员%')
    while (rs.next())
      delete from mail where id=rs.getInt(1)
      

  4.   

    好的,谢谢shuixin13(犬犬(心帆)) ,马上结贴^_^