List:General Discussion« Previous MessageNext Message »
From:Benjamin Pflugmann Date:June 25 1999 2:35am
Subject:Re: SQL help
View as plain text  
Hi.

Please provide more information, especially the output from

> mysqldump -d your_database table1 table2

select productID,quantity,retail,item_total from table1 where sessionID='123456';
(here, do your insert from below if you did not already do so)
select productID,quantity,retail,item_total from table2 where produceID IN (x,y,z,...)

(where x,y,z are the productIDs listed in the output from the first SELECT)

Additionally, please describe what the what you would have expected
instead (since I am not sure if I understand your description below
correctly).

Bye,

        Benjamin.


On Thu, Jun 24, 1999 at 03:58:54PM -0600, jeffb@stripped wrote:
> Hi there,
> 
> I'm trying to figure out "INSERT INTO ... SELECT..." and I'm having trouble
> with the syntax.
> 
> I have 2 table with a few identical field names and I want to copy all
> records of a given ID from the first into the second table. However, I only
> get the first of the records inserted the first time I run the query and
> none subsequently	. 
> 
> Here's the SQL I'm trying:
> 
> insert into table2 
> (productID,quantity,retail,item_total) 
> select productID,quantity,retail,item_total from table1 where
> sessionID='123456';
> 
> My server is 3.22.20. on AIX 4.2.1
> 
> Any help would be appreciated.
> 
> Thanks much,

Attachment: [application/pgp-signature]
Thread
SQL helpJeff Beard25 Jun
  • Re: SQL helpBenjamin Pflugmann25 Jun
    • Re: SQL helpJeff Beard25 Jun
      • Re: SQL helpBenjamin Pflugmann26 Jun