Reputation:
i am a newbie and i cannot write a subquery.i have two table one csv
and other is master
.i want to delete records from csv
where values
present in master
.
my csv
table
id(PK) phone
1 1234
2 2345
3 7777
my master
table
urn phone
1 9988
2 1234
3 7777
to find the values present in csv and master i query.
select phone from csv where phone in (select phone from master)
phone
1234
7777
now how can i delete the matching values from csv in a single query from php?
Upvotes: 0
Views: 27
Reputation: 1271231
Basically, you can replace the select
with delete from
:
delete from csv
where phone in (select phone from master);
Upvotes: 1