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
alternative current in to a pc
Need help on rollover buttons in flash in Flash CS4 and AS 3
Transparent PNG IE8
how can i get Hard Disk Serial number (unique) in C#.net web application ??
How can I force Graphics.MeasureString to consider the font style?
Office 2010 KMS on non-AD DNS?
ORA: 6533 Subscript out of range
Microsoft.Exchange.Search.
ExSearch.e
xe 80% resources
How to Transfer All ZIP files from a FTP Directory using Powershell
Wordpress widget with visual editor for non-HTML savvy users