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. Ha

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 SQ

Re: Efficient select/insert

2005-05-19 Thread Jonathan Mangin
- Original Message - From: "Eamon Daly" <[EMAIL PROTECTED]> To: "Jonathan Mangin" <[EMAIL PROTECTED]> Cc: Sent: Thursday, May 19, 2005 1:17 PM Subject: Re: Efficient select/insert my $sql = sprintf <<'EOF', join(',', @array);

Re: Efficient select/insert

2005-05-19 Thread Eamon Daly
inal Message - From: "Jonathan Mangin" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Cc: 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

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) { > @ar

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,

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: > Sent: Tuesday, April 26, 2005 3:20 PM > Subj

Re: Efficient select/insert

2005-04-26 Thread Jonathan Mangin
- Original Message - From: <[EMAIL PROTECTED]> To: "Jonathan Mangin" <[EMAIL PROTECTED]> Cc: 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 woul

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 = "

Re: Efficient select/insert

2005-04-26 Thread Jonathan Mangin
- Original Message - From: "Jonathan Mangin" <[EMAIL PROTECTED]> To: 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 @a

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 = $dbh->prepare(

Re: Efficient Select

2001-02-02 Thread scott
Give this a try. I used table aliases out of habit. SELECT table1.id FROM table1 A LEFT JOIN table2 B ON A.UserName = B.username AND B.Group != 'Dedicated' WHERE B.username IS NULL AND A.StopTime = 0; - Scott > Hi I was wondering if anyone could help m

RE: Efficient Select

2001-02-02 Thread Ryan Wahle
-Greg Johnson > > > > -Original Message- > > From: Drew [mailto:[EMAIL PROTECTED]] > > Sent: Friday, February 02, 2001 4:00 PM > > To: [EMAIL PROTECTED] > > Subject:Effi

RE: Efficient Select

2001-02-02 Thread Drew Wilder-Goodwin
Sent: Friday, February 02, 2001 4:00 PM > To: [EMAIL PROTECTED] > Subject:Efficient Select > > Hi I was wondering if anyone could help me find the most efficient.. or > at least A efficient way to preform the following

RE: Efficient Select

2001-02-02 Thread Johnson, Gregert
PROTECTED]] Sent: Friday, February 02, 2001 4:00 PM To: [EMAIL PROTECTED] Subject: Efficient Select Hi I was wondering if anyone could help me find the most efficient.. or at least A efficient way to p

Efficient Select

2001-02-02 Thread Drew
Hi I was wondering if anyone could help me find the most efficient.. or at least A efficient way to preform the following task: I have a table that has some data, one of which is a UserName column. I have another table that has multiple rows for that UserName. So table one looks like: id