Re: Like operator
От | Richard Huxton |
---|---|
Тема | Re: Like operator |
Дата | |
Msg-id | 4666C04E.5070807@archonet.com обсуждение исходный текст |
Ответ на | Like operator ("rupesh bajaj" <rupesh.bajaj@gmail.com>) |
Список | pgsql-general |
rupesh bajaj wrote: > Hi, > Is Like operator can be used to join two relation. If yes what is its use? > And how it is used? It tests a column for a partial match. So: 'abc' LIKE 'a%' = true 'abc' LIKE 'a_c' = true 'abc' LIKE 'A%' = false See the manuals for details on other wildcard options and alternative pattern-matching systems. You can store the pattern in a column too, though that's less common: richardh=> SELECT * FROM targets; tgt ----------- abc123def ghi123def (2 rows) richardh=> SELECT * FROM patterns; patt ------- abc% %123% (2 rows) richardh=> SELECT tgt,count(*) FROM targets, patterns WHERE tgt LIKE patt GROUP BY tgt ORDER BY tgt; tgt | count -----------+------- abc123def | 2 ghi123def | 1 (2 rows) HTH -- Richard Huxton Archonet Ltd
В списке pgsql-general по дате отправления: