当前位置:主页>销售管理软件> 列表

请问一个SQL操作句子!需要高手!

销售管理软件版1楼: 我需要update一个表cj_lrcjb,where中的xh,kch来自另外一个表cj_lnjb(xh,ckh).请问改如何写这个句子。
update cj_lrcjb set bz=''123'' where (xh,kch) in select xh,kch from cj_lncjb;
大概是这样,但是这是不对的,不能用in.请问高手,可以用什么来定位这个条件!急啊!都怪自己不学好!!

2楼: update cj_lrcjb set bz=''123'' From (select xh,kch from cj_lncjb) a where xh= a.xh and kch= a.kch
大概是这样子,你看行不行? 如免费小型财务软件

3楼: update cj_lrcjb set bz=''123'' From cj_lncjb a where cj_lrcjb.xh= a.xh and cj_lrcjb.kch= a.kch

4楼: update cj_lrcjb set bz=''123'' from cj_lrcjb a,cj_lnjb b
where b.xh=''XX'' and b.ckh=''XX''

5楼: 我用的是oracle,好像不行,不支持使用from句子

6楼: update cj_lrcjb set bz=''123'' where xh in select xh,kch from cj_lncjb and
kch in select xh,kch from cj_lncjb 你看看这样写行吗

销售管理软件版7楼: update cj_lrcjb
set bz=''123''
where EXISTS (
select xh,kch
from cj_lncjb
Where xh=cj_lrcjb.xh
and kch=lrcjb.kch)

8楼: fyhxf的操作超出了xh,kch的组合值,就是xh,kch都存在,但是组合起来的不属于该情况。
caiaj的是完全操作cj_lrcjb表.

9楼: update cj_lrcjb set bz=''123'' From
cj_lrcjb join cj_lncjb on xh= a.xh and kch= a.kch


注:ON后表达式你自定义,我没有看.你想定什么条件都行

10楼: oracle也只能就这样了但服务器会自动优化的

11楼: update cj_lrcjb
set bz=''123''
where (xh,kch) in (
select xh,kch
from cj_lncjb
Where xh=cj_lrcjb.xh
and kch=lrcjb.kch)

12楼: In 太慢了,别的都在Orcal上不能用,就是我的答案了
update cj_lrcjb
set bz=''123''
where EXISTS (
select xh,kch
from cj_lncjb
Where xh=cj_lrcjb.xh
and kch=lrcjb.kch) 如简单好用的财务软件

13楼: update cj_lrcjb set bz=''123'' where
xh in (select distinct(xh) from cj_lncjb) and
kch in (select kch from cj_lncjb)
简单的问题不要搞复杂了

销售管理软件版14楼: 接受答案了.



上一篇:关于多表查询的速度问题,求个算法!   下一篇:没有了