mysql delete语句不能用别名
在mysql数据库里运行delete语句
delete from tb_js_ryxx t where t.sydw_id='402880006add1e93016ade0c1d060029' and t.id =‘123’;
发现会报错:
[Err] 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 't where t.sydw_id='402880006add1e93016ade0c1d060029' and t.id=‘123’ ’
网上说mysql数据库delete语句不能用别名
改成这样即可
delete from tb_js_ryxx where sydw_id='402880006add1e93016ade0c1d060029' and id =‘123’;
想用别名也可以
要在 delete 和 from 中间加上别名
delete t from tb_js_ryxx t where t.sydw_id='402880006add1e93016ade0c1d060029' and t.id =‘123’;