You are here: join the two tables and at the same time update a field, is it possible? « PHP Programming Language « IT news, forums, messages
join the two tables and at the same time update a field, is it possible?

Posted by newbie on 07/22/07 00:07

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 tables and at the same time 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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация