Need help to update 2 rows in the same table, been searching & testing with no real luck.
I need to update 2 rows based on the URL below... id=145&contactuname=json101&contactid=7&memberid=1&confirm=2
Updating these fields: ustatus, memberid, contactid, contactuname
Table structure:
CREATE TABLE `contacts` (
`id` INT(40) NOT NULL AUTO_INCREMENT,
`ustatus` TINYINT(1) NULL DEFAULT '0',
`memberid` INT(20) NOT NULL,
`contactid` INT(20) NOT NULL,
`contactuname` VARCHAR(31) NOT NULL,
`blocked` INT(1) NULL DEFAULT '0',
PRIMARY KEY (`id`)
)
No clue how these work, anyone able to show how my table could work with the queries below?
update table1
set col1 = a.col1, col2 = a.col2, col3 = a.col3 from
(select col1, col2, col3 from table2 where <expression>) as a
where table1.col1 <expression>
UPDATE Table1
SET (Col1, Col2, Col3, Col4) =
(SELECT Col1a, Col2a, Col3a, Col4a FROM Table2 WHERE Col5a=Table1.Col5)
WHERE Col5 IN (SELECT Col5a FROM Table2 )