Jump to content


Photo

can't make this work...


  • Please log in to reply
2 replies to this topic

#1 AV1611

AV1611
  • Members
  • PipPipPip
  • Advanced Member
  • 997 posts

Posted 29 March 2006 - 08:55 PM

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)

#2 Guest_footballkid4_*

Guest_footballkid4_*
  • Guests

Posted 30 March 2006 - 12:24 AM

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] INTO tblname VALUES (valuestrung) [!--sql2--][/div][!--sql3--]
SQL assumes that you have a value for every column (including ID)

#3 AV1611

AV1611
  • Members
  • PipPipPip
  • Advanced Member
  • 997 posts

Posted 30 March 2006 - 04:41 PM

Hey, Football!

I went with this...



$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());





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users