查询是:
插入 char_inventory (charid,location,slot,itemid,quantity) 值(从 charid 不在的字符中选择 charid(从 char_inventory 中选择 charid,其中 itemid=65535),0,0,65535,10000);
查询是:
插入 char_inventory (charid,location,slot,itemid,quantity) 值(从 charid 不在的字符中选择 charid(从 char_inventory 中选择 charid,其中 itemid=65535),0,0,65535,10000);
使用INSERT INTO...SELECT
语句LEFT JOIN
INSERT INTO char_inventory (charid, location, slot, itemid, quantity)
SELECT chars.charid, 0 , 0, 65535, 10000
FROM chars
LEFT JOIN char_inventory
ON chars.charid = char_inventory.charid AND
char_inventory.itemid = 65535
WHERE char_inventory.charid IS NULL
这个怎么样
insert into char_inventory (charid,location,slot,itemid,quantity)
select charid,0,0,65535,10000 from chars where charid not in (select charid from char_inventory where itemid=65535)
试试这个:
insert into char_inventory (charid,location,slot,itemid,quantity)
select charid,0,0,65535,10000
from chars
where charid not in (select charid from char_inventory where itemid=65535)