and 2 by the sequence
INSERT - SELECT - INSERT - SELECT.
It would be excellent to write:
SELECT * INSERT table (name, value1, value2, value3)
VALUES (?,?,?,?), (?,?,?,?), (?,?,?,?);
and, having on the entry the data for the insert on the exit, to get the
result of insert at once
On Jan 30, 2008 12:50 PM, Dmitry E. Oboukhov wrote:
Is it possible to add to the syntax of the INSERT operator appoximately
in such way:
SELECT list INSERT [IGNORE] INTO ... - an added one.
SELECT list UPDATE - an added one.
PS: I understand that adding the changes into a language is a
On Jan 30, 2008 12:50 PM, Dmitry E. Oboukhov wrote:
Is it possible to add to the syntax of the INSERT operator appoximately
in such way:
SELECT list INSERT [IGNORE] INTO ... - an added one.
SELECT list UPDATE - an added one.
PS: I understand that adding the changes into a
-
From: Kristen G. Thorson [mailto:[EMAIL PROTECTED]
Sent: mercredi, 14. décembre 2005 22:14
To: RAPPAZ Francois
Cc: mysql@lists.mysql.com
Subject: Re: Is select ... insert working with 3.23(58) ??
RAPPAZ Francois wrote:
Hi
I'm stuck with a sequence of sql commands to duplicate
Hi
I'm stuck with a sequence of sql commands to duplicate a record whithin the
same table (server is 3.23.58):
I have table t1 with data : char and id: auto_increment, int, unsigned, primary
key.
I would like to do the following
SET @template = 104;
DROP table IF EXISTS tmp;
CREATE TABLE
RAPPAZ Francois wrote:
Hi
I'm stuck with a sequence of sql commands to duplicate a record whithin the
same table (server is 3.23.58):
I have table t1 with data : char and id: auto_increment, int, unsigned, primary
key.
I would like to do the following
SET @template = 104;
DROP table IF
the SELECT/INSERT combo right?
--
Use Rojo (RSS/Atom aggregator)! - visit http://rojo.com.
See irc.freenode.net #rojo if you want to chat.
Rojo is Hiring! - http://www.rojonetworks.com/JobsAtRojo.html
Kevin A. Burton, Location - San Francisco, CA
AIM/YIM - sfburtonator, Web - http
if the record doesn't exist and then an INSERT.
This should be 2x faster than the SELECT/INSERT combo right?
--
Use Rojo (RSS/Atom aggregator)! - visit http://rojo.com.
See irc.freenode.net #rojo if you want to chat.
Rojo is Hiring! - http://www.rojonetworks.com/JobsAtRojo.html
Kevin
and then an INSERT.
This should be 2x faster than the SELECT/INSERT combo right?
I'm not entirely clear what you're talking about, but you could also
have a look at INSERT IGNORE..., or INSERT... ON DUPLICATE KEY UPDATE,
or REPLACE INTO...:
http://dev.mysql.com/doc/mysql/en/insert.html
http
Simon Garner wrote:
I'm not entirely clear what you're talking about, but you could also
have a look at INSERT IGNORE..., or INSERT... ON DUPLICATE KEY UPDATE,
or REPLACE INTO...:
The problem is that I do NOT want it to update.
Also.. REPLACE causes the row to be DELETED and INSERTED
On 15/06/2005 11:22 a.m., Kevin Burton wrote:
Simon Garner wrote:
I'm not entirely clear what you're talking about, but you could also
have a look at INSERT IGNORE..., or INSERT... ON DUPLICATE KEY UPDATE,
or REPLACE INTO...:
The problem is that I do NOT want it to update.
Also.. REPLACE
This would be even faster if you could concatenate all of the elements
of
@array into a single list then you could say:
#My PERL skills are non existent so you need to write this part.
#I am assuming that @array is holding a list of string values.
foreach my $element (@array) {
@araylist
[EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Cc: mysql@lists.mysql.com
Sent: Thursday, May 19, 2005 11:52 AM
Subject: Re: Efficient select/insert
This would be even faster if you could concatenate all of the elements
of
@array into a single list then you could say:
#My PERL skills are non existent so
- Original Message -
From: Eamon Daly [EMAIL PROTECTED]
To: Jonathan Mangin [EMAIL PROTECTED]
Cc: mysql@lists.mysql.com
Sent: Thursday, May 19, 2005 1:17 PM
Subject: Re: Efficient select/insert
my $sql = sprintf 'EOF', join(',', @array);
SELECT col2, col3, col4
FROM table1
WHERE col1
In article [EMAIL PROTECTED],
Eamon Daly [EMAIL PROTECTED] writes:
my $sql = sprintf 'EOF', join(',', @array);
SELECT col2, col3, col4
FROM table1
WHERE col1 IN (%s)
EOF
my $sth = $dbh-prepare($sql);
$sth-execute() or die $sth-errstr();
This code is susceptible for an SQL injection
Thanks, that works (I'll have to read a bit to learn why)
except for one thing I didn't mention. (Everybody Lies :)
How ugly is this?
$sql = INSERT into $table2; # dynamic name with $user_id as root
$sql .= sprintf 'EOF', join(',', @array);
I see.
I suppose this produced quite a few grins.
Happy
On 4/26/05, Jonathan Mangin [EMAIL PROTECTED] wrote:
I would like to select several rows from one table
and insert them into another nearly identical table
using Perl/DBI:
my @array = $q-param(); # HTML checkboxes
foreach my $element (@array) {
my $sql = select col2, col3, col4 from
Jonathan Mangin [EMAIL PROTECTED] wrote on 04/26/2005 05:09:23
PM:
- Original Message -
From: [EMAIL PROTECTED]
To: Jonathan Mangin [EMAIL PROTECTED]
Cc: mysql@lists.mysql.com
Sent: Tuesday, April 26, 2005 3:20 PM
Subject: Re: Efficient select/insert
Jonathan Mangin [EMAIL
I would like to select several rows from one table
and insert them into another nearly identical table
using Perl/DBI:
my @array = $q-param(); # HTML checkboxes
foreach my $element (@array) {
my $sql = select col2, col3, col4 from table1
where col1 = ?;
my $sth =
- Original Message -
From: Jonathan Mangin [EMAIL PROTECTED]
To: mysql@lists.mysql.com
Sent: Tuesday, April 26, 2005 11:26 AM
Subject: Efficient select/insert
I would like to select several rows from one table
and insert them into another nearly identical table
using Perl/DBI:
my @array
Jonathan Mangin [EMAIL PROTECTED] wrote on 04/26/2005 12:26:20
PM:
I would like to select several rows from one table
and insert them into another nearly identical table
using Perl/DBI:
my @array = $q-param(); # HTML checkboxes
foreach my $element (@array) {
my $sql = select col2,
- Original Message -
From: [EMAIL PROTECTED]
To: Jonathan Mangin [EMAIL PROTECTED]
Cc: mysql@lists.mysql.com
Sent: Tuesday, April 26, 2005 3:20 PM
Subject: Re: Efficient select/insert
Jonathan Mangin [EMAIL PROTECTED] wrote on 04/26/2005 12:26:20
PM:
I would like to select several rows
Is there any way to select insert at the same time? What I want to do
is select say 10 out 13 field values from one table and dump it into
another table. Would it be possible to do this via a select and an
insert at the same time and how exactly would the sql statement look? OR
do I have
Hi.
On Tue, Sep 25, 2001 at 08:39:01AM -0300, [EMAIL PROTECTED] wrote:
Is there any way to select insert at the same time?
Yes. Have a look at
INSERT ... SELECT
and
CREATE TABLE ... SELECT
in the manual.
Bye,
Benjamin.
What I want to do
is select say 10 out 13 field
Hi Ashwin!
Is there any way to select insert at the same time? What I want to do
http://www.mysql.com/doc/I/N/INSERT_SELECT.html
there? Also, is there any way without me creating new tables with all
its fields all the time to copy over the fields from certain tables to
new tables
25 matches
Mail list logo