Subject | Re: where clause |
---|---|
Author | Svein Erling Tysvær |
Post date | 2005-06-03T07:48:08Z |
Hi Grant!
There are a couple of things to consider
(besides using '||' and not '| |'):
1) On large tables such a search will currently be slow, since
expression indexes are only available in Firebird 2 and forward.
2) If one of the fields are NULL, then the match will fail even if the
other contains the entire clause, e.g. if
FirstName Lastname
ab cde
abc de
abcde <null>
then your query will only match the first two rows.
An alternative is to have a third column Fullname which you can
populate through INSERT and UPDATE triggers (you could also make that
column all UPPERCASE to make searching simpler).
Set
There are a couple of things to consider
(besides using '||' and not '| |'):
1) On large tables such a search will currently be slow, since
expression indexes are only available in Firebird 2 and forward.
2) If one of the fields are NULL, then the match will fail even if the
other contains the entire clause, e.g. if
FirstName Lastname
ab cde
abc de
abcde <null>
then your query will only match the first two rows.
An alternative is to have a third column Fullname which you can
populate through INSERT and UPDATE triggers (you could also make that
column all UPPERCASE to make searching simpler).
Set
--- In firebird-support@yahoogroups.com, Grant Brown wrote:
> Hi all,
>
> in the where clause of a sql query is the following valid and is
> there a better way to do it
>
> where (BD.FirstName | | BD.LastName) = 'abc';
>
> --
> Regards,
> Grant Brown
>
> Product Development Manager
> Phone : 02 4229 1185
> Mobile : 0412 926 995
> Email : grant@s...
> Web : www.sitedoc.com.au
>
> SiteDoc - Easy to Use - Powerful Results