Re: [GENERAL] Wild Cards

2001-01-27 Thread Oliver Elphick

Adam Haberlach wrote:
  On Thu, Jan 25, 2001 at 08:40:23AM -0500, No Name wrote:
   I am not able to get Wildcards in PostgreSQL, I know its * (asterisk), but
   its not working. can someone show me a example or something?
  
  It's % and you have to use the LIKE operator.
  
  SELECT * FROM thistable WHERE name LIKE '%marley';
 
Alternatively use regular expressions as with grep:

   SELECT * FROM thistable WHERE name ~* 'scrooge$'

~  is regular expression match
~* is case-insensitive regular expression match

-- 
Oliver Elphick[EMAIL PROTECTED]
Isle of Wight  http://www.lfix.co.uk/oliver
PGP: 1024R/32B8FAA1: 97 EA 1D 47 72 3F 28 47  6B 7E 39 CC 56 E4 C1 47
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839  932A 614D 4C34 3E1D 0C1C
 
 "Come now, and let us reason together, saith the LORD; 
  though your sins be as scarlet, they shall be as white
  as snow; though they be red like crimson, they shall 
  be as wool." Isaiah 1:18 





Re: [GENERAL] Wild Cards

2001-01-26 Thread Adam Haberlach

On Thu, Jan 25, 2001 at 08:40:23AM -0500, No Name wrote:
 I am not able to get Wildcards in PostgreSQL, I know its * (asterisk), but
 its not working. can someone show me a example or something?

It's % and you have to use the LIKE operator.

SELECT * FROM thistable WHERE name LIKE '%marley';

-- 
Adam Haberlach|A cat spends her life conflicted between a
[EMAIL PROTECTED]   |deep, passionate, and profound desire for
http://www.newsnipple.com |fish and an equally deep, passionate, and
'88 EX500 |profound desire to avoid getting wet.