Erol KAHRAMAN wrote:
hi guys,
i am newbie in postgresql. I need some help; i am trying to write like
this:
select * from TABLE where IN ('value1','valeue2',....)
You'll need to provide a column-name:
... WHERE mycolumn IN (...)
but is it possible to give values from file.
select * from TABLE where IN file
Not directly. You'd normally handle this in whatever language you are
using to query the database.
If you have a lot of values, you might find it useful to read them into
a temporary table.
CREATE TEMP TABLE my_values (...);
COPY my_values ... FROM <filename>;
ANALYSE my_values;
SELECT * FROM main_table JOIN my_values ON main_table_column =
my_values_column
Of course, that assumes you have your values one per line - see the
manuals for details of what COPY can handle.
--
Richard Huxton
Archonet Ltd