Skip to content
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

Closed
firebird-automations opened this issue Jan 24, 2009 · 8 comments
Closed

UPDATE/DELETE rows by filter on other table [CORE2288] #2713

firebird-automations opened this issue Jan 24, 2009 · 8 comments

Comments

@firebird-automations
Copy link
Collaborator

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'

@firebird-automations
Copy link
Collaborator Author

Commented by: Sean Leyne (seanleyne)

The suggested syntax is not SQL standard compliant! Why should we implement it?

@firebird-automations
Copy link
Collaborator Author

Commented by: @asfernandes

For UPDATE, there is MERGE.

For DELETE, there is CORE2005 that is about to extend MERGE too.

@firebird-automations
Copy link
Collaborator Author

Commented by: Eugenk Konkov (kes)

>The suggested syntax is not SQL standard compliant! Why should we implement it?
Because of it is handy. and PostgreSQL has implemented it

@firebird-automations
Copy link
Collaborator Author

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.

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

Link: This issue is replaced by CORE815 [ CORE815 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

Link: This issue is replaced by CORE3020 [ CORE3020 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Won't Fix [ 2 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

status: Resolved [ 5 ] => Closed [ 6 ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant