4 messages in com.mysql.lists.perlRe: Load Data into more than 1 Table
FromSent OnAttachments
Scott Simpson03 Nov 2004 08:49 
Dan Bolser03 Nov 2004 09:35 
Darren Duncan04 Nov 2004 11:16 
Dan Bolser04 Nov 2004 12:42 
Subject:Re: Load Data into more than 1 Table
From:Dan Bolser (dm@mrc-dunn.cam.ac.uk)
Date:11/04/2004 12:42:10 PM
List:com.mysql.lists.perl

Sorry, first time I read your mail wrong, I thought you had two files, part of both to go to one table... Now I realize you have one file which you want to part load twice.

This is easy...

From "man mysqlimport" (or it shoudl be... I found it at http://dev.mysql.com/doc/mysql/en/mysqlimport.html)...

--columns=column_list, -c column_list This option takes a comma-separated list of column names as its value. The order of the column names indicates how to match up data file columns with table columns.

(in linux) say

ln -s my_double_table_dump table_name_one.pipe ln -s my_double_table_dump table_name_two.pipe

then

mysqlimport table_name_one.pipe --columns=1,2

ooops... That wont work, columns wan't table column names...

Cay you say

--columns=NULL,two,three --columns-one,NULL,NULL

??

On Thu, 4 Nov 2004, Darren Duncan wrote:

Once the writeable views support is functional, you should be able to just create a view that joins the two tables and has the interface matching your file; then just insert into the view from each file line. -- Darren Duncan

At 4:49 PM +0000 11/3/04, Scott Simpson wrote:

Can I use 'LOAD DATA INFILE' to load data into more than 1 table?

For example, say I have a text file containing

1 birthday cat 2 anniversary dog

and I want column 2 in table birthdays and column 3 in table pets and I'm lazy and can't be bothered to split the file or loop through an insert statement.

Can someone suggest a shortcut?