-1

查询是:

插入 char_inventory (charid,location,slot,itemid,quantity) 值(从 charid 不在的字符中选择 charid(从 char_inventory 中选择 charid,其中 itemid=65535),0,0,65535,10000);

4

3 回答 3

0

使用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
于 2013-01-24T00:53:46.560 回答
0

这个怎么样

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)
于 2013-01-24T00:55:48.087 回答
0

试试这个:

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)
于 2013-01-24T00:59:16.320 回答