私は3つのテーブルを持っています:
categories (id)
product_models(id, category_id)
products(id, product_id, category_id)
各テーブル(lorem ipsum content)にレコードがあり、データを接続したい。
このクエリを実行して、すでにproduct_modelsを変更しました:
update product_models
set category_id = (select id from categories order by RAND() limit 1)
すべての製品を製品モデルにマップし、カテゴリも更新する単一のクエリを使用するにはどうすればよいですか?