我有以下查询,可能会合并为一个或两个更大的查询:
SELECT user, password, email FROM users WHERE user = 'njp316' LIMIT 1;
INSERT IGNORE INTO collectors_users (username, password, email, dateadded, subscribed)
VALUES (user, password, email, NOW(), 'Y');
这将拉回多行,因此需要循环:
SELECT barcode FROM collections WHERE user = user;
INSERT IGNORE INTO collections_collections (username, barcode)
VALUES (user, barcode);
显然我对 SQL 不熟悉,所以只是在寻求帮助。谢谢。