0

Hello. I need some help to update two table.. This is my coding:

$query = "UPDATE br.discharged_Date, b.book_Status SET 
                br.patron_ID = b.patron_ID
                FROM borrow br
                INNER JOIN book b
                ON br.patron_ID = b.patron_ID
                WHERE b.patron_ID = '$patron_ID'";
4
Contributors
3
Replies
15
Views
3 Years
Discussion Span
Last Post by kamini_1
0

Your're only updating one column in table br here. You can use joins like this to update 2 tables but you'd need to include the second column of the second table in the SET part of the command.
To be perfectly honest, the entire command is a bit wrong for a UPDATE statement. You don't the FROM for example.
The mysql docs might be useful Click Here

0

Your query is all wrong: you are asking the database to update, not a table but a row. The update query should be something like: 'UPDATE atable SET atable.acolumn = avalue.....

0
UPDATE Table1, Table2
SET Table1.LastName = 'DR. XXXXXX' 
,Table2.WAprrs = 'start,stop'
FROM Table1 T1, Table2 T2
WHERE T1.id = T2.id
and T1.id = '010008'

Edited by Dani: Formatting fixed

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.