Subject Re: [firebird-support] select with constant value in where-clause
Author Daniel Miller
As an amateur - I'd suggest using an indexed field in the where clause, and choosing an invalid value that is less than the 1st real entry.
 
--
Daniel
 
 
------ Original Message ------
From: "Josef.Gschwendtner@... [firebird-support]" <firebird-support@yahoogroups.com>
Sent: 12/19/2015 9:46:02 AM
Subject: [firebird-support] select with constant value in where-clause
 


Hi,


the following select fetches all records of the table (FB 2.5.4) and obviously brings no resultset.

select * from Mytable where 1=0


Is there a trick to force Firebird not to scan all records?

We sometimes use such a statement (in for select loops) to get different datasets and process it in the loop.
select ... from Table1 where :InputParam = 'A'
union

select ... from Table2 where :InputParam = 'B'


Regards,

Josef