从select插入多个值

cgvd09ve  于 2021-06-20  发布在  Mysql
关注(0)|答案(0)|浏览(271)

我有用于插入数据的mysql查询:

INSERT INTO transactions (transaction_hash, address_sender_id, address_receiver_id)
SELECT ? AS transaction_hash,
       id AS address_sender_id,
       tmp.address_receiver_id
FROM addresses
JOIN
  (SELECT id AS address_receiver_id
   FROM addresses
   WHERE address = ?) AS tmp
WHERE address = ?.

对于单个数据,如 [hash, address1, address2] 它工作得很好。如何重构此查询以插入多个值: [[hash_1, hash_2], [address1_1, address1_2], [address2_1, address2_2]]
我把hash作为静态字符串。和两个不同的地址ID(也是字符串),它们来自另一个表

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题