帮助进行quiry - 更新是否会影响我的现有数据? [英] Help with a quiry - update is whiping my existing data when it shouldent?

查看:152
本文介绍了帮助进行quiry - 更新是否会影响我的现有数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的一般要求


更新`Antrix` .creature_proto`

设置`health` =(从'antrix2`选择`health` .`creature_proto`其中`entry` =(从'Antrix``creature_proto`中选择条目);


我有一个名为Antrix的dB和一个名为antrix2

我想使用antrix2.creature_proto中的数据覆盖colums Antrix.creature_proto。(health)中的数据。(健康状况)....


这有效......但是问题是......其中Antrix.entry中的条目不在antrix2.entry中..它将Antrix.health中的数据设置为0。


任何想法如何停止这个?

This is my general quiry

update `Antrix`.`creature_proto`
set `health` = (select `health` from `antrix2`.`creature_proto` where `entry` = (select entry from `Antrix`.`creature_proto`);

I have a dB named Antrix and one named antrix2
I want to overwrite the data in colums Antrix.creature_proto.(health) with the data from antrix2.creature_proto.(health)....

this works... but hte problem is.... where entries in Antrix.entry arent in antrix2.entry.. it sets the data from Antrix.health to 0 on those entries.

Any ideas how to stop this?

推荐答案

....其中Antrix.entry中的条目不在antrix2.entry中..它将Antrix.health中的数据设置为0 。


是的,它会的!


尝试类似的东西:

....where entries in Antrix.entry arent in antrix2.entry.. it sets the data from Antrix.health to 0 on those entries.

Yes, It Will !

Try something like :

展开 | 选择 | Wrap | 行号


UPDATE dbo.Antrix.creature_proto

SET health = dbo.antrix2.creature_proto.health

WHERE dbo.Antrix.creature_proto.entry = dbo.antrix2.creature_proto.entry和dbo.antrix2.creature_proto.health> 25和dbo.antrix2.creature_proto.attacktime> 700和dbo.antrix2.creature_proto.level> 1和dbo.antrix2.creature_proto.mindamage> 1和dbo.antrix2.creature_proto.maxdamage> 1;



现在这是我的查询。


它表示你在dbo ect附近的语法错误


i无法找到问题。
UPDATE dbo.Antrix.creature_proto
SET health = dbo.antrix2.creature_proto.health
WHERE dbo.Antrix.creature_proto.entry = dbo.antrix2.creature_proto.entry and dbo.antrix2.creature_proto.health > 25 and dbo.antrix2.creature_proto.attacktime > 700 and dbo.antrix2.creature_proto.level > 1 and dbo.antrix2.creature_proto.mindamage > 1 and dbo.antrix2.creature_proto.maxdamage > 1;


this is my query now.

it says you have an error in syntax near dbo ect

i cant find a problem.


这是否意味着你已经解决了问题?
Does that mean you''ve sorted the problem out ?


这篇关于帮助进行quiry - 更新是否会影响我的现有数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆