New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UPDATE/DELETE rows by filter on other table [CORE2288] #2713
Comments
Commented by: Sean Leyne (seanleyne) The suggested syntax is not SQL standard compliant! Why should we implement it? |
Commented by: @asfernandes For UPDATE, there is MERGE. For DELETE, there is CORE2005 that is about to extend MERGE too. |
Commented by: Eugenk Konkov (kes) >The suggested syntax is not SQL standard compliant! Why should we implement it? |
Commented by: @dyemanov UPDATE/DELETE with joins are ambiguous when the same table is used as both the operation target and inside the join clause. Because of that, many implementations (e.g. in MSSQL) has restrictions that makes this feature quite limited, IMHO. So I'd better go for the MERGE statement instead. |
Modified by: @pcisarstatus: Resolved [ 5 ] => Closed [ 6 ] |
Submitted by: Eugenk Konkov (kes)
Is replaced by CORE815
Is replaced by CORE3020
create table A ( ID, name varchar(17) )
create table B (ID integer , parent_ID integer, name varchar(16) )
insert into A ( 1, 'a' )
insert into A ( 2, 'b' )
insert into A ( 3, 'c' )
insert into B ( 1, 1, 'a' )
insert into B ( 2, 1, 'b' )
insert into B ( 3, 1, 'c' )
insert into B ( 4, 2, 'd' )
EXAMPLE:
delete all rows from A which has no details:
delete from A
left join B on B.parent_ID = http://A.ID
where http://B.ID is null
update all rows in A which has details with name in ('c', 'd'):
update A
left join B on B.parent_ID = http://A.ID
set
name = 'd'
where http://B.name = 'c' or http://B.name = 'd'
The text was updated successfully, but these errors were encountered: