Re: newbie question * compare integer in a "where IN" statement
В списке pgsql-sql по дате отправления:
| От | Thomas Kellerer |
|---|---|
| Тема | Re: newbie question * compare integer in a "where IN" statement |
| Дата | |
| Msg-id | ivjii4$udk$1@dough.gmane.org обсуждение исходный текст |
| Ответ на | newbie question * compare integer in a "where IN" statement (Jose Ig Mendez <jmendez@andago.com>) |
| Список | pgsql-sql |
Jose Ig Mendez, 13.07.2011 09:36:
>
> Hi everybody,
>
> I'm trying to compare in a sentence like this (using PostGres 8.3) :
>
> select * from myTable where id_integer IN ('1,2,3,4')
>
> I want to get the records which key "id_integer" is 1 or 2 or 3 or 4. the type od my "id", of course, is integer.
>
> I've tried many differents ways but I cannot get the result I want.
> I would like to cast the integer parameter I cannot change the part after "IN" it has to be a "string list".
>
> Do I have to use a function ? I would like not to use it.
>
> How can I compare a key (integer) with a lists of values ?
Just leave out the quotes:
select *
from myTable
where id_integer IN (1,2,3,4)
В списке pgsql-sql по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера