From: Ron <ronljohnsonjr@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: SQL Question about like
Date: Mon, 10 Aug 2020 11:48:34 -0500
Message-ID: <c7717e00-1356-07e9-bbff-487ff5509047@gmail.com> (raw)
In-Reply-To: <00d20cc2-0c97-8ce7-768a-a2c8bc396d19@gmx.de>
References: <00d20cc2-0c97-8ce7-768a-a2c8bc396d19@gmx.de>
On 8/10/20 11:37 AM, pgml@gmx.de wrote:
> Hello,
>
> my SQL question is, why psql doesn't return the record?
>
> create table lll (text char(100));
> insert into lll (text) values ('10% - Ersthelfer');
>
> select * from lll where text like '10% - Ersthelfer';
>
> Other databases (Maria, SQL Server, YARD) do this.
> What can I do in pg, to get the result?
Add a wildcard character. (Also, why use LIKE in an equality?)
test=# select * from lll where text like '10% - Ersthelfer';
text
------
(0 rows)
test=# select * from lll where text like '10% - Ersthelfer%';
text
--------------------------------------------------------------
10% - Ersthelfer
(1 row)
test=#
test=#
test=# select * from lll where text = '10% - Ersthelfer';
text
--------------------------------------------------------------
10% - Ersthelfer
(1 row)
--
Angular momentum makes the world go 'round.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: ronljohnsonjr@gmail.com
Subject: Re: SQL Question about like
In-Reply-To: <c7717e00-1356-07e9-bbff-487ff5509047@gmail.com>
References: <00d20cc2-0c97-8ce7-768a-a2c8bc396d19@gmx.de> <c7717e00-1356-07e9-bbff-487ff5509047@gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox