Re: newbie question * compare integer in a "where IN" statement - Mailing list pgsql-sql

From Pavel Stehule
Subject Re: newbie question * compare integer in a "where IN" statement
Date
Msg-id CAFj8pRCxb5PkQC7FBps4AJtwLZ4WsKxc1SLsg1P5Dqh4oAZZnw@mail.gmail.com
Whole thread Raw
In response to newbie question * compare integer in a "where IN" statement  (Jose Ig Mendez <jmendez@andago.com>)
Responses Re: newbie question * compare integer in a "where IN" statement  (Jose Ig Mendez <jmendez@andago.com>)
List pgsql-sql
Hello

you can try

SELECT .. FROM .. WHERE id = ANY(string_to_array('1,2,3,4,5',','))

other forms are slow

Regards

Pavel Stehule

2011/7/13 Jose Ig Mendez <jmendez@andago.com>

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 ?

I'm desperate

THANX IN ADVANCE

--

José Ignacio Méndez Yanes

Área de Operaciones / Area of Operations

Phone: +34 916 011 373 / +34 946 416 066

Mobile: +34 666 431 099

Fax: +34 916 011 372 / +34 944 318 286

ÁndagoAlcalde Ángel Arroyo 10, 1ª Planta. 28904. Getafe, Madrid
Kanala Bidea, Edif. 103, 1ª Izda. Parque Tecnológico. 48170. Zamudio, Bizkaia
www.andago.com

Síguenos en: Twitter - Facebook - LinkedIn - YouTube

Antes de imprimir este mensaje, asegúrese de que es necesario. Consider the environment before printing this mail.

AVISO LEGAL


ANDAGO CONSULTING SL / ANDAGO INGENIERÍA, SL le informa que los datos facilitados por Ud. y utilizados para el envío de esta comunicación serán objeto de tratamiento automatizado o no en nuestros ficheros, con la finalidad de gestionar la agenda de contactos de nuestra empresa y para el envío de comunicaciones profesionales por cualquier medio electrónico o no. Vd. podrá en cualquier momento ejercer el derecho de acceso, rectificación, cancelación y oposición en los términos establecidos en la Ley Orgánica 15/1999. El responsable del tratamiento es ANDAGO CONSULTING SL / ANDAGO INGENIERIA SL, con domicilio en C/ ALCALDE ANGEL ARROYO, 10, 28904, Getafe (Madrid).

El contenido de esta comunicación, así como el de toda la documentación anexa, es confidencial y va dirigido únicamente al destinatario del mismo. En el supuesto de que usted no fuera el destinatario, le solicitamos que nos lo indique y no comunique su contenido a terceros, procediendo a su destrucción.

DISCLAIMER


The content of this communication and any attached information is confidential and exclusively for the use of the addressee. If you are not the addressee, we ask you to notify to the sender and do not pass its content to another person, and please be sure you destroy it.


pgsql-sql by date:

Previous
From: Thomas Kellerer
Date:
Subject: Re: newbie question * compare integer in a "where IN" statement
Next
From: Jose Ig Mendez
Date:
Subject: Re: newbie question * compare integer in a "where IN" statement