Re: [SQL] using matches on int4 - Mailing list pgsql-sql

From George Moga
Subject Re: [SQL] using matches on int4
Date
Msg-id 36B9E215.C0FA3F0E@flex.ro
Whole thread Raw
In response to using matches on int4  (Gregory Holston <holston@itd.nrl.navy.mil>)
List 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@flex.ro
  Braila, ROMANIA



pgsql-sql by date:

Previous
From: "Jackson, DeJuan"
Date:
Subject: RE: [SQL] using matches on int4
Next
From: pat@patoche.org
Date:
Subject: problem with join & count