1 Answer
1

MySQL won't let you modify the same table that you're selecting from, but it does let you specify multiple tables in the UPDATE clause.

I've rephrased your UPDATE query to use LEFT JOIN's instead of nested sub-SELECT's.

Since I am not completely sure this query will do exactly what you need, you should first verify that you will get the desired updated value for barang.jml_tersedia. Here it is, re-phrased as a SELECT query: