查询执行,但它只影响1行,这是第一个找到的。我设法让它的工作,因为预期这里是工作查询:
select *
from Game.dbo.TCharacterAbility;
select t.user_id, i.*
from TCharacterAbility as i
join TCharacter as t on i.char_id = t.id
where (i.strength > '746' or
i.dexterity > '746' or
i.quickness > '746' or
i.mentality > '746' or
i.health > '746' or
i.intelligence > '746')
下面是我纠结的一个问题:
DEClARE @user_id int;
DEClARE @char_id int;
SELECT @char_id = id
FROM TCharacter as x
INNER JOIN tcharacterability y ON x.id = y.char_id
WHERE (y.strength > '746' OR y.dexterity > '746' OR
y.quickness > '746' OR y.mentality > '746' OR
y.health > '746' OR y.intelligence > '746')
SELECT @user_id = user_id
FROM TCharacter as x
INNER JOIN tcharacterability y ON x.id = y.char_id
WHERE (y.strength > '746' OR y.dexterity > '746' OR
y.quickness > '746' OR y.mentality > '746' OR
y.health > '746' OR y.intelligence > '746')
INSERT INTO [User].[dbo].[TDisconnect] (user_id, server_id, char_id) VALUES (@user_id, 1, @char_id)
我已经尽我所能地声明了操作符,但是失败得很惨。
有关这些表的详细信息t.characterability
-色谱柱:
char_id | strength | dexterity | mentality | quickness | health | intelligence |
t.character
:
id (equal to char_id from characterability) | user_id | name | etc |
除了id = char_id
之外,没有其他共享信息。
我的目标是这个查询找到所有的结果,而不仅仅是第一个结果,并插入适当数量的匹配项。
1条答案
按热度按时间0dxa2lsx1#
变量可以是标量值,并且不能保存多个值,因此需要另一种方法来实现