Re: [SQL] using matches on int4

From: George Moga <george(at)flex(dot)ro>
To: Gregory Holston <holston(at)itd(dot)nrl(dot)navy(dot)mil>, SQL PostgreSQL <pgsql-sql(at)postgreSQL(dot)org>
Subject: Re: [SQL] using matches on int4
Date: 1999-02-04 18:08:21
Message-ID: 36B9E215.C0FA3F0E@flex.ro
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Gregory Holston wrote:

> Hi List,
> I tried to do this query:
> real=> select * from users where id ~ 2;
> ERROR: There is no operator '~' for types 'int4' and 'int4'
> You will either have to retype this query using an explicit cast,
> or you will have to define the operator using CREATE OPERATOR
> My question is how would I create an operator?
>
> Thanks in advance,
>
>
> -Greg
>
> .......
>
> I was trying to find all people with ids of 200.
>
> -Greg
>

If I undestund what do you want:

select * from users where %id/100 = 2;

This returns all records whith ids between [200 ... 299]

I use PostgbreSQL 6.4 on Red Hat Linux 5.2 with 2.2.0 kernel.

-------
Best,
George Moga,
george(at)flex(dot)ro
Braila, ROMANIA

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message pat 1999-02-04 20:39:28 problem with join & count
Previous Message Jackson, DeJuan 1999-02-04 18:02:39 RE: [SQL] using matches on int4