Subject Re: [firebird-support] something like delphi's 'isempty' ref/eDN6052838979
Author Svein Erling Tysvaer
Hi Dennis!

EXISTS is your answer:

select * from customers c
where
exists(select * from reg_header rh
where rh.customer_code=c.customer_code)
and c.customer_code = '23232323'
order by name

HTH,
Set

Dennis wrote:
> Deal all.
>
> I want to ask the base with a query and to return me if there is a least on
> record with specific criteria.
>
> Using select code_a from sales where partno='2323' the firebird computes all
> the records where are going to be transferred to the client.
>
> Is there any way to reduce this time, so the firebird will answer, yes there
> is one record with these criteria.
>
> Note: To make it clear, I am working with the ibx7 and I am talking with the
> database relationally, so there is no case to transfer all the query's
> results to client directly
>
> Another similar approach:
>
> For instance, I want to list all customers where they have movements: So the
> query I developed is the follow:
>
> select * from customers
>
> where
>
> (select count(*) from reg_header where customer_code='23232323') > 0
>
> order by name
>
> Here, function count lasts too much, can we have something faster? Like
> delphi's 'not ismpty'?
>
> Regards
>
> Dennis