Posted by Toby A Inkster on 07/22/07 01:47
newbie wrote:
> Can I join the two table an update the field 'scanned' on the rows
> being selected?
Yep.
UPDATE table1
INNER JOIN table2 ON table1.id=table2.id
SET table1.scanned=1
WHERE table2.owned_by='sam';
UPDATE table1
INNER JOIN table2 ON table1.id=table2.id
SET table1.scanned=CASE WHEN table2.notes='boring' THEN 0 ELSE 1 END
WHERE table2.owned_by='sam';
--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.12-12mdksmp, up 31 days, 5:19.]
Parsing an HTML Table with PEAR's XML_HTTPSax3
http://tobyinkster.co.uk/blog/2007/07/20/html-table-parsing/
Navigation:
[Reply to this message]
|