Reputation: 91
I need to make select where id in ( and here i want to load text file, with one int value per one line)
Any help would be appreciated
Upvotes: 6
Views: 4235
Reputation: 119
You have to use temporary table
CREATE TEMPORARY TABLE `temp` (`id` bigint(20) NOT NULL, PRIMARY KEY(`id`))
then load data from file using
LOAD DATA INFILE ...
and then select your data using temporary table
SELECT * FROM some_table s, temp t WHERE s.id = t.id
Upvotes: 5
Reputation: 521379
Because your input text file has only one int value per line, you should be able to get away with this:
LOAD DATA INFILE 'input.txt' INTO TABLE yourTable
Upvotes: 2