Re: [SQL] using matches on int4

Поиск
Список
Период
Сортировка
От George Moga
Тема Re: [SQL] using matches on int4
Дата
Msg-id 36B9E215.C0FA3F0E@flex.ro
обсуждение исходный текст
Ответ на using matches on int4  (Gregory Holston <holston@itd.nrl.navy.mil>)
Список 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 по дате отправления:

Предыдущее
От: "Jackson, DeJuan"
Дата:
Сообщение: RE: [SQL] using matches on int4
Следующее
От: pat@patoche.org
Дата:
Сообщение: problem with join & count