开发者社区 问答 正文

mysql删除数据为啥不能用AS别名,为什么?

1
报错,错误代码: 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'as dr
WHERE dr.id IN (

    '4028978146e139920146e1438ba80004',
    '402' at line 3

mysql删除数据不能用AS别名吗,为什么?

展开
收起
落地花开啦 2016-02-28 17:04:18 2831 分享 版权
1 条回答
写回答
取消 提交回答
  • 喜欢技术,喜欢努力的人

    详细语法规则在mysql控制台用help delete 和 help select 查看,注意语法结构中table_references和tbl_name是有区别的,table_references才能设别名,所以改成这样试试
    `DELETE
    FROM dr USING tb_sys_dept_role AS dr
    WHERE dr.id IN (

        '4028978146e139920146e1438ba80004',
        '4028978146e17b120146e17b5cfb0000',
        '4028978146e14d990146e14e08af0000'
    )`
    2019-07-17 18:49:48
    赞同 展开评论