基本格式:
DELETE t1 FROM t1,t2 WHERE t1.id=t2.id 或 DELETE FROM t1 USING t1,t2 WHERE t1.id=t2.id
示例应用:
DELETE coupon FROM coupon,member WHERE coupon.mem_no=member.reg_no AND coupon.`status`=0 AND coupon.`batch_no`='yaoqingpengyou001' AND member.`mobile` IN (
182xxxx9886
)
//关联用户表,根据手机号码查询该会员号对应的券(批次号为yaoqingpengyou001且未使用status=0)删除。
DELETE FROM coupon USING coupon,member WHERE coupon.mem_no=member.reg_no AND coupon.`status`=0 AND coupon.`batch_no`='yaoqingpengyou001' AND member.`mobile` IN (
182xxxx9886
)
182xxxx9886
)