I'm trying to do an update accross 2 tables which also has a view joins connected an additional two tables.
I get no syntax error but affected rows is zero so I'm wondering how the logic is meant to be written.. this is what i tried:
UPDATE resources R
INNER JOIN cost C
ON R.rid=R.rid
INNER JOIN users U
ON R.uid=U.uid
INNER JOIN money M
ON M.bid=C.bid
SET R.q = R.q - C.q, M.q = M.q - 1
WHERE C.bid=? AND U.uid= ?
If i remove this part of the query M.q = M.q - 1
and the join for M
it works fine but if i add it then no rows every get updated.
The query is support to remove the quantity totals from resources
based on cost quantity
AND remove 1
from the the table money
field q
.
How do i fix this =/ ?