Subject | Re: [firebird-support] Check if record exist |
---|---|
Author | Greg Strauss |
Post date | 2005-01-27T17:16:41Z |
"Helen Borrie" <helebor@...> wrote in message
news:5.2.0.9.2.20050127201110.03aa8d38@......
select 1 from Person where PersId=:PersId
be just as efficient (and a bit more SQL generic) than what you suggest? It
also returns 1 or empty set.
I'd like to understand the benefits (if any) of doing this...
select 1 from rdb$database
where exists (select 1 from Person where PersId=:PersId)
Thx!
Greg
news:5.2.0.9.2.20050127201110.03aa8d38@......
> If you just want to check for existence and return something small:Would doing:
>
> select 1 from rdb$database
> where exists (select 1 from Person where PersId=:PersId)
> returns 1 if there is at least one matching row; returns empty set
> otherwise.
select 1 from Person where PersId=:PersId
be just as efficient (and a bit more SQL generic) than what you suggest? It
also returns 1 or empty set.
I'd like to understand the benefits (if any) of doing this...
select 1 from rdb$database
where exists (select 1 from Person where PersId=:PersId)
Thx!
Greg