Subject | Re[3]: [ib-support] Delete where exists problem |
---|---|
Author | Svein Erling Tysvaer |
Post date | 2003-03-20T15:14:12Z |
At 15:57 20.03.2003 +0200, you wrote:
delete from tbl_service_rel
where
exists(
select * from tbl_service_rel rel join tbl_service svc on
(rel.service_id = svc.service_id)
where svc.party_id = 10700013277)
which basically should delete all rows in tbl_service_rel if there is one
record matching your criteria. Your SQL references three tables - with two
references to tbl_service_rel and one to tbl_service. By reducing this to
two references (only one reference to tbl_service_rel) I changed the query
to only delete the rows that actually contain the desired service_id. It
has nothing to do with SQL89 vs SQL92 - I use SQL92 whenever I can, but in
a subselect you have to use the equality operator if you want to reference
the master table, JOIN isn't an option.
Set
>Essentially what you propose is the same query just using SQL89 joinNot quite. Your statement was
>syntax
delete from tbl_service_rel
where
exists(
select * from tbl_service_rel rel join tbl_service svc on
(rel.service_id = svc.service_id)
where svc.party_id = 10700013277)
which basically should delete all rows in tbl_service_rel if there is one
record matching your criteria. Your SQL references three tables - with two
references to tbl_service_rel and one to tbl_service. By reducing this to
two references (only one reference to tbl_service_rel) I changed the query
to only delete the rows that actually contain the desired service_id. It
has nothing to do with SQL89 vs SQL92 - I use SQL92 whenever I can, but in
a subselect you have to use the equality operator if you want to reference
the master table, JOIN isn't an option.
Set