Jump to content

making a concat in an insert


Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/2464-making-a-concat-in-an-insert/
Share on other sites

Archived

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

×
×
  • 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.