can I update a field (atomically) using a join?
- From: newbie <mitbbsmj@xxxxxxxxx>
- Date: Sun, 22 Jul 2007 00:03:46 -0000
Say I have two tables
table1
---------------------------------------------------------------
| id | scanned | title |
---------------------------------------------------------------
| 01 | 0 | book |
---------------------------------------------------------------
| 02 | 0 | paper |
---------------------------------------------------------------
| 03 | 1 | paper |
---------------------------------------------------------------
table2
---------------------------------------------------------------
| id | owned_by | notes |
---------------------------------------------------------------
| 01 | tom | good |
---------------------------------------------------------------
| 01 | sam | boring |
---------------------------------------------------------------
| 02 | sam | terrific |
---------------------------------------------------------------
Can I join the two table an update the field 'scanned' on the rows
being selected? i.e., I am looking for something like:
$query = "SELECT table1.title, table1.scanned, table2.owned_by,
table2_notes ".
"FROM table1, table2 ". "WHERE table1.id = table2.id";
// (however, I want to update table1.scanned field of all the entries
being selected, and hopefully atomic to the above select)
Is it possible?
Thanks a lot
.
- Follow-Ups:
- Re: can I update a field (atomically) using a join?
- From: Toby A Inkster
- Re: can I update a field (atomically) using a join?
- Prev by Date: Re: Simpler urls
- Next by Date: Re: Framework, which one?
- Previous by thread: problem with charset
- Next by thread: Re: can I update a field (atomically) using a join?
- Index(es):