Jump to content


Photo

making a concat in an insert


  • Please log in to reply
No replies to this topic

#1 beanfair

beanfair
  • Members
  • Pip
  • Newbie
  • 9 posts

Posted 24 August 2005 - 04:40 AM

I am updating a table, inserting multiple rows from a previous form.
This works and inserts the rows
mysql_select_db($database_zen, $zen);
$query_rsCC = "INSERT INTO tblPackingList (marketwk, crop, out) SELECT tblPackingListOLD.marketwk, tblCrop.crop, tblPackingListOLD.cc AS out FROM tblCrop INNER JOIN tblPackingListOLD ON tblCrop.cropID = tblPackingListOLD.crop WHERE tblPackingListOLD.marketwk=17 AND tblPackingListOLD.cc>0";
$rsCC = mysql_query($query_rsCC, $zen) or die(mysql_error());
However, I also need to insert values that are concatenation. The concat works and creates the value that I need.
SELECT CONCAT("cc",tblPackingListOLD.marketwk, tblCrop.crop) AS pid
FROM tblCrop INNER JOIN tblPackingListOLD ON tblCrop.cropID = tblPackingListOLD.crop

Now I need help incorporating the concat into the insert query so that (pid, marketwk, crop, out) are inserted

Thanks




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users