Mark
> Does anyone know if it's possible to insert mutilple records into 1
table
> in one query?
yes
> Something like -
>
> insert into mytable (id,name,job_number,job_date) values
> ('1','Mark','AA1','2002-04-15')
>
> insert into mytable (id,name,job_number,job_date) values
> ('2','Mark','AA2','2002-04-16')
>
> insert into mytable (id,name,job_number,job_date) values
> ('3','Mark','AA3','2002-04-17')
>
> - all at once if the data is the result of a form page.
Sorry I can't give you a manual reference - my ISP/MySQL's site aren't
playing like nice children at the moment!?
However if you look at the template for the INSERT command notice that
after the VALUES clause there is an ellipsis - something like:
VALUES(expression [,expression]...) [,(expression, etc)...]
thus you can add as many rows' worth of data as you like - each row
within its own set of parentheses:
insert into mytable (id,name,job_number,job_date) values
('1','Mark','AA1','2002-04-15'),
('2','Mark','AA2','2002-04-16'),
('3','Mark','AA3','2002-04-17')
NB please double check my syntax/memory.
Regards,
=dn
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php