MySql 的@符号定义一个变量在sql里的占位符作用
set @orderNo := 'order3'; 先定义一个@开头的变量值为 order3
SELECT * t_order WHERE order_no = @orderNo; 查询订单号为 order3 的订单
DELETE FROM t_order WHERE order_no = @orderNo; 删除订单号为 order3 的订单
delete from t_order_item where order_id = (select id from t_order where order_no = @orderNo);
![](https://images.cnblogs.com/cnblogs_com/zhuwenjoyce/945554/o_201113020411my-zhifubao-shouqianma.jpeg)