Jump to content

Archived

This topic is now archived and is closed to further replies.

AV1611

can't make this work...

Recommended Posts

what am I doing wrong with this subquery?

insert into table2
values (Select
Min(table1.it_date) AS it_date,
firstpass.insptype,
firstpass.`process`,
firstpass.product,
firstpass.descr,
firstpass.rev_level,
firstpass.serialno,
firstpass.failed
From
firstpass
Group By
firstpass.serialno)

Share this post


Link to post
Share on other sites
Guest footballkid4
Av! Haven't seen you around here for a while.

Anyways:
Do you have an auto_inc ID in both tables? If so, you might want to provide a fieldlist, because the way you are doing it:
[!--sql--][div class=\'sqltop\']SQL[/div][div class=\'sqlmain\'][!--sql1--][span style=\'color:blue;font-weight:bold\']INSERT[/span] [color=green]INTO[/color] [color=orange]tblname[/color] VALUES (valuestrung) [!--sql2--][/div][!--sql3--]
SQL assumes that you have a value for every column (including ID)

Share this post


Link to post
Share on other sites
Hey, Football!

I went with this...



[code]
$query0 = mysql_query("
insert into firstpass2
(Select
Min(firstpass.it_date) AS it_date,
firstpass.insptype,
firstpass.`process`,
firstpass.product,
firstpass.descr,
firstpass.rev_level,
firstpass.serialno,
firstpass.failed
From firstpass
Group By firstpass.serialno)") or die('71'.mysql_error());
[/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.