Re: Syntax for wildcard selection
| От | Jason Turner |
|---|---|
| Тема | Re: Syntax for wildcard selection |
| Дата | |
| Msg-id | 20010816113614.A6590@camille.indigoindustrial.co.nz обсуждение исходный текст |
| Ответ на | Syntax for wildcard selection (Scott Holmes <sholmes@pacificnet.net>) |
| Ответы |
Re: Syntax for wildcard selection
|
| Список | pgsql-general |
[snip:Informix trouble]
> tried to do a wildcard search, thus "where field_name LIKE 'AB%VN'". The
> trailing values (after the %) are not recognized correctly.
[...]
> How is this accomplished with PostgreSQL? Are we limited to wildcard
> searches as "where field_name LIKE 'AB%'"?
Well, it's hardly a conclusive proof, but it works the way you'd hope
on a toy problem....
foo=> DROP TABLE test;
DROP
foo=> CREATE TABLE test (name varchar(20),age int);
CREATE
foo=> INSERT INTO test VALUES ('AGNES', 20);
INSERT 586226 1
foo=> INSERT INTO test VALUES ('HELMUT', 33);
INSERT 586227 1
foo=> INSERT INTO test VALUES ('ANDREW', 33);
INSERT 586228 1
foo=> INSERT INTO test VALUES ('AGNEW', 302);
INSERT 586229 1
foo=> SELECT * FROM test WHERE name LIKE 'AG%ES';
name | age
-------+-----
AGNES | 20
(1 row)
foo=> SELECT * FROM test WHERE name LIKE 'AG%E';
name | age
------+-----
(0 rows)
foo=> SELECT * FROM test WHERE name LIKE 'AG%EW';
name | age
-------+-----
AGNEW | 302
(1 row)
Someone see anything I'm missing?
Jason
--
Indigo Industrial Controls Ltd.
64-21-343-545
jasont@indigoindustrial.co.nz
В списке pgsql-general по дате отправления: