feature request: statement SELECT...(INSERT|UPDATE) :)

2008-01-30 Thread Dmitry E. Oboukhov
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

Re: feature request: statement SELECT...(INSERT|UPDATE) :)

2008-01-30 Thread Jochem van Dieten
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

Re: feature request: statement SELECT...(INSERT|UPDATE) :)

2008-01-30 Thread Martijn Tonies
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

RE: Is select ... insert working with 3.23(58) ??

2005-12-15 Thread RAPPAZ Francois
- 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

Is select ... insert working with 3.23(58) ??

2005-12-14 Thread RAPPAZ Francois
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

Re: Is select ... insert working with 3.23(58) ??

2005-12-14 Thread Kristen G. Thorson
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

idepontent inserts? Allowing INSERT to fail faster than SELECT/INSERT

2005-06-14 Thread Kevin Burton
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

Re: idepontent inserts? Allowing INSERT to fail faster than SELECT/INSERT

2005-06-14 Thread mfatene
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

Re: idepontent inserts? Allowing INSERT to fail faster than SELECT/INSERT

2005-06-14 Thread Simon Garner
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

Re: idepontent inserts? Allowing INSERT to fail faster than SELECT/INSERT

2005-06-14 Thread Kevin Burton
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

Re: idepontent inserts? Allowing INSERT to fail faster than SELECT/INSERT

2005-06-14 Thread Simon Garner
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

Re: Efficient select/insert

2005-05-19 Thread Jonathan Mangin
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

Re: Efficient select/insert

2005-05-19 Thread Eamon Daly
[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

Re: Efficient select/insert

2005-05-19 Thread Jonathan Mangin
- 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

Re: Efficient select/insert

2005-05-19 Thread Harald Fuchs
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

Re: Efficient select/insert

2005-05-19 Thread Jonathan Mangin
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

Re: Efficient select/insert

2005-04-29 Thread Dawid Kuroczko
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

Re: Efficient select/insert

2005-04-27 Thread SGreen
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

Efficient select/insert

2005-04-26 Thread Jonathan Mangin
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 =

Re: Efficient select/insert

2005-04-26 Thread Jonathan Mangin
- 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

Re: Efficient select/insert

2005-04-26 Thread SGreen
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,

Re: Efficient select/insert

2005-04-26 Thread Jonathan Mangin
- 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

Select Insert

2001-09-25 Thread Ashwin Kutty
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

Re: Select Insert

2001-09-25 Thread Benjamin Pflugmann
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

Re: Select Insert

2001-09-25 Thread jim barchuk
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