From: | Ron <ronljohnsonjr(at)gmail(dot)com> |
---|---|
To: | pgsql-general(at)lists(dot)postgresql(dot)org |
Subject: | Re: SQL Question about like |
Date: | 2020-08-10 16:48:34 |
Message-ID: | c7717e00-1356-07e9-bbff-487ff5509047@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 8/10/20 11:37 AM, pgml(at)gmx(dot)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.
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Lewis | 2020-08-10 16:49:53 | Re: UUID or auto-increment |
Previous Message | Ravi Krishna | 2020-08-10 16:38:10 | Re: UUID or auto-increment |