Microsoft
Software
Hardware
Network
Question : MySQL update set Concatenate question
I have a MySQL query that globally updated f column is one table with a concatenation of column values and strings from another table. I seemed to have stumbled on the syntax that will update all of the rows:
UPDATE bookings_items SET desc_en = (SELECT CONCAT('#',prty_id,': ',property.prty_title) FROM property WHERE bookings_items.id_ref_exte
rnal = property.prty_id)
This sets the desc_en column to "#"+the property id from the property table + the property title from the property table WHERE the id_ref_external in bookings.items and prty_id in property are equal. Guess I need to change to:
UPDATE bookings_items SET desc_en = (SELECT CONCAT('#',property.prty_i
d,': ',property.prty_title) FROM property WHERE bookings_items.id_ref_exte
rnal = property.prty_id)
or
UPDATE bookings_items SET desc_en = (SELECT CONCAT('#',prty_id,': ',prty_title) FROM property WHERE bookings_items.id_ref_exte
rnal = property.prty_id)
This seems to work to change every row in the table and pull from the corresponding data in the property table.
What I'd like to do is make the same update for s specified row in the bookings_items table. i.e. only want to make the Change for those rows in bookings.items where id_ref_external is explicitly specified (e.g. $_POST[new_id])
Any help with that? Seems like the specific case would be easier than the global case.
Answer : MySQL update set Concatenate question
Syntax check:
$mysqlqry =
"UPDATE bookings_items SET desc_en = " .
"(SELECT CONCAT('#',prty_id,': ',property.prty_title) FROM property " .
"WHERE bookings_items.id_ref_exte
rnal = property.prty_id) " .
"WHERE id_ref_external = $_POST[new_id]";
Random Solutions
jquery validator and asp.net updatepanel
How do I get the F6 storage drivers to work on a 8100 Elite Convertable Mini Tower?
Page progress updates from a long running process
ScrollText In DialgBox? - Delphi
Not downloading Offline address book files. A server (URL) could not be located. 0X8004010F
DHCP service failed to see a directory server
Exchange 2010 setup.com /preparead fails
ADmodify.exe "mailbox rights modification disabled" ??
Oracle Join null rows.
asp.net vb.net render html to component