Jump to content

can't make this work...


AV1611

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)
Link to comment
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)
Link to comment
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]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.