I am trying to delete multiple rows selected from checkbox from two tables namely pdn_subscription_ctx and subscriber_profile which have three primary keys mcc,mnc and msin from mysqldb but I could not able to do that. here is the command I wrote:
DELETE x.*
, p.*
FROM pdn_subscription_ctx x
JOIN subscriber_profile p
ON x.mcc = p.mcc
AND x.mnc = p.mnc
AND x.msin = p.msin
WHERE (p.mcc,p.mnc,p.msin) IN ( (244, 56, "0x1000000004"),(244, 59, "0x1000000002"),(289, 88, "0x1000000001" ) )
It does not delete any rows and does not show errors either. Here are the sample data for pri.key fields: mcc mnc msin 244 56 0x1000000004
Your code works just fine assuming your model and mine are equivalent
drop table if exists pdn_subscription_ctx , subscriber_profile ;
create table pdn_subscription_ctx(mcc int,mnc int ,msin varchar(20));
create table subscriber_profile(mcc int,mnc int ,msin varchar(20));
insert into pdn_subscription_ctx values
(244, 56, "0x1000000004"),(244, 59, "0x1000000002"),(289, 88, "0x1000000001");
insert into subscriber_profile values
(244, 56, "0x1000000004"),(244, 59, "0x1000000002"),(289, 88, "0x1000000001");
DELETE pdn_subscription_ctx.*, subscriber_profile.*
FROM pdn_subscription_ctx
INNER JOIN subscriber_profile ON pdn_subscription_ctx.mcc = subscriber_profile.mcc AND
pdn_subscription_ctx.mnc = subscriber_profile.mnc AND
pdn_subscription_ctx.msin = subscriber_profile.msin
WHERE (subscriber_profile.mcc,subscriber_profile.mnc,subscriber_profile.msin) IN ( (244, 56, "0x1000000004"),(244, 59, "0x1000000002"),(289, 88, "0x1000000001" ))
;
select * from pdn_subscription_ctx;
Empty set (0.00 sec)
select * from subscriber_profile;
Empty set (0.00 sec)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.