From: Thomas Kellerer <spam_eater@gmx.net>
To: pgsql-sql@postgresql.org
Subject: Re: newbie question * compare integer in a "where IN" statement
Date: Wed, 13 Jul 2011 09:47:38 +0200
Message-ID: <ivjii4$udk$1@dough.gmane.org> (raw)
In-Reply-To: <4E1D4B0B.8070400@andago.com>
References: <4E1C4322.5030001@andago.com>
<4E1D4B0B.8070400@andago.com>
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)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: spam_eater@gmx.net
Subject: Re: newbie question * compare integer in a "where IN" statement
In-Reply-To: <ivjii4$udk$1@dough.gmane.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox