I have 2 tables:
URL_table
| link_id | link_url|
<=== schema
user_table
| link_id | is_visited |
<==== schema
When i want to delete a value in user_table,
and my input is link_url
,
i have to resolve the link_id
first from URL_table
select link_id from URL_table where link_url="www.example.com"
and then
delete from user_table where link_id='....
since link_id is a foreign key in URL table,
is there a way i can do this in a single query?
delete u
from user_table u
join url_table l on l.link_id = u.link_id
where l.link_url = 'www.example.com"'
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.