Re: query-question

Поиск
Список
Период
Сортировка
Искать
От
Stephan Szabo
Тема
Re: query-question
Дата
Msg-id
20030911080207.B29873-100000@megazone.bigpanda.com
Ответ на
query-question (Alexander Blüm)
Список
Дерево обсуждения
query-question Alexander Blüm <mailinglists1@gmx.de>
Re: query-question Csaba Nagy <nagy@ecircle-ag.com>
Re: query-question Stephan Szabo <sszabo@megazone.bigpanda.com>
Re: query-question Alexander Blüm <mailinglists1@gmx.de>
Re: query-question Pavel Stehule <stehule@kix.fsv.cvut.cz>
Re: query-question Holger Marzen <holger@marzen.de>

On Thu, 11 Sep 2003, [ISO-8859-1] Alexander Bl�m wrote:

> hello,
>
> I'm facing an odd problem.
> I have a query:
>
> SELECT "K�rzel", "Autor(en)", "Titel"
> FROM "tblTitelangaben"
> WHERE "Titel"||"K�rzel"||"Monographie-K�rzel"||"Autor(en)" ILIKE '%er%';
>
> this works like a charm.
>
> but if I add another ||"something" - which might be emtpy, I get no
> results.. why?
>
> WHERE
> "Titel"||"K�rzel"||"Monographie-K�rzel"||"Autor(en)"||"Herausgeber"
> ILIKE '%er%';
>
> || is the same as "OR", is it not?

No, it's string concatenation. Also, remember that NULLs are special
a || NULL is NULL.  You can use coalesce(field,"") to get an empty string
if field is NULL.

> 1 OR 0 = 1
> 1 OR 1 = 1
> 0 OR 0 = 0
> right?

And even for OR, the above isn't true in SQL because of NULLs.
  1 | 0 | N
1 1 | 1 | N
0 1 | 0 | N
N N | N | N

В списке pgsql-general по дате отправления
От: Vivek Khera
Дата:
От: Alexander Blüm
Дата:
Сообщение: Re: query-question
FAQ