Subject | Re: [firebird-support] Check if record exist |
---|---|
Author | Ann W. Harrison |
Post date | 2005-01-27T17:32:02Z |
Greg Strauss wrote:
singleton select.
select and stops after the first qualifying record.
Assuming that there's an ascending index on PersId, this singleton
select will also touch only one record and is more generic:
select min (p.PersId) from Person p where p.PersId = :PersId
Regards,
Ann
>If you have more than one qualifying person, that query will not be a
> Would doing:
> select 1 from Person where PersId=:PersId
singleton select.
>Because there is only one rdb$database record, that is a singleton
> select 1 from rdb$database
> where exists (select 1 from Person where PersId=:PersId)
>
select and stops after the first qualifying record.
Assuming that there's an ascending index on PersId, this singleton
select will also touch only one record and is more generic:
select min (p.PersId) from Person p where p.PersId = :PersId
Regards,
Ann