Re: SELECT question (splitting a field)

From: "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com>
To: "Madison Kelly" <linux(at)alteeve(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: SELECT question (splitting a field)
Date: 2007-09-04 19:49:08
Message-ID: dcc563d10709041249w7f0230c8s21dbed5b8d2e4fb6@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 9/4/07, Madison Kelly <linux(at)alteeve(dot)com> wrote:
> Hi all,
>
> Hopefully a quick question...
>
> Why does:
>
> nmc=> SELECT 'Y' AS local FROM domains WHERE dom_name='test.com';
> local
> -------
> Y
> (1 row)
>
> Work but:
>
> nmc=> SELECT 'Y' AS local FROM domains WHERE '@'||dom_name IN
> ('mkelly(at)test(dot)com');
> local
> -------
> (0 rows)
>
> Not work?

because @dom_name isn't IN mkelly(at)test(dot)com?

I think you're looking for pattern matching.

select 'Y' as local from domains where dom_name ilike '%test.com%'

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2007-09-04 19:51:02 Re: SELECT question (splitting a field)
Previous Message jesse.waters 2007-09-04 19:48:18 UTF8 frustrations