CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
不看会后悔的Windows XP之经验谈 简单快捷DIY实用家庭影院
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  Oracle >  基础和管理

关于update的很急的问题在线等待,解决了给100分

楼主jackie8008()2004-11-03 11:47:30 在 Oracle / 基础和管理 提问

有两个表  
  一个gd_expert有confirm,code,shcool字段,一个是person有title_id,code,univ_id,person中的code   与gd_expert关联,univ_id与gd_expert的shcool关联    
  现在要求以person中title_id字段中1开头的字段关联gd_expert表将gd_expert表中的confirm字段置为1    
  怎么做,告诉我直接的sql语句就可以了  
  问题点数:100、回复次数:11Top

1 楼lialin(阿林)回复于 2004-11-03 11:51:31 得分 10

update   gd_expert   a   set   confirm=1   where   exists(select   'x'   from   person   b   where   a.gd_expert=b.code   and   a.shcool=b.univ_id   and   b.title_id   like   '1%');Top

2 楼bzszp(SongZip)回复于 2004-11-03 11:55:09 得分 10

try:  
  update   gd_expert   a   set   confirm   =(select   1   from   person   b   where   a.code=b.code   and  
  a.shcool=b.univ_id   and   tigle_id   like   '1%'   and   rownum=1)  
  where   exists(select   1   from   person   b   where   a.code=b.code   and  
  a.shcool=b.univ_id   and   tigle_id   like   '1%'  
  );  
   
  Top

3 楼ORARichard(没钱的日子......)回复于 2004-11-03 11:56:10 得分 0

update   gd_expert   a   set   a.confirm=1   where   exists   (select   1   from   person   b   where   a.shcool=b.univ_id)   and   b.title_id   like   '1%'Top

4 楼ORARichard(没钱的日子......)回复于 2004-11-03 11:58:11 得分 0

update   gd_expert   a   set   a.confirm=1   where   exists   (select   1   from   person   b   where   a.shcool=b.univ_id)   and   a.shcool=b.univ_id   and   b.title_id   like   '1%'  
  Top

5 楼ORARichard(没钱的日子......)回复于 2004-11-03 12:08:56 得分 0

还是少了个条件  
   
  update   gd_expert   a   set   a.confirm=1   where   exists   (select   1   from   person   b   where   a.shcool=b.univ_id   and   a.code=b.code)   and   a.code=b.code   and   a.shcool=b.univ_id   and   b.title_id   like   '1%'  
  Top

6 楼hzf005(红蜘蛛)回复于 2004-11-03 13:12:13 得分 10

update   gd_expert   a   set   confirm   =(select   1   from   person   b   where   a.code=b.code   and  
  a.shcool=b.univ_id   and   tigle_id   like   '1%'   and   rownum=1)  
  where   exists(select   1   from   person   b   where   a.code=b.code   and  
  a.shcool=b.univ_id   and   tigle_id   like   '1%'  
  );  
   
  Top

7 楼jackie8008()回复于 2004-11-03 13:29:21 得分 0

怎么都不行呢?  
  Top

8 楼ORARichard(没钱的日子......)回复于 2004-11-03 13:42:13 得分 60

怎么不行,如果出错报什么错,如果不错,那更新了那些值呢。Top

9 楼jackie8008()回复于 2004-11-03 13:50:17 得分 0

to   ORARichard  
  我按照你写的  
  update   gd_expert   a   set   a.confirm=1   where   exists   (select   1   from   person   b   where   a.shcool=b.univ_id   and   a.code=b.code)   and   a.code=b.code   and   a.shcool=b.univ_id   and   b.title_id   like   '1%'  
  输入后  
  查询编辑器  
  包错:ur   SQL   syntax   near   'a   set   a.confirm=1   where   exists   (select   1   from   person   b   where   a.shcool=b.univ_id   '   at   line   1Top

10 楼bluelamb(bluelamb)回复于 2004-11-03 13:56:13 得分 10

update   (select   a.confirm,a.code,a.shcool,b.   from   gd_expert   a,person   b  
  where   a.code=b.code   and   a.school=b.univ_id)set   confirm=1   where   title_id   like   '1%'Top

11 楼jackie8008()回复于 2004-11-03 13:56:47 得分 0

to   ORARichard  
  由QQ嘛?我的54987407想在QQ上请教请教你Top

相关问题

  • 急!在线等待
  • 急!!!!!!!!!在线等待
  • 急!!!!!!!!!!!!!!!(在线等待)
  • 在线等待,急!!!
  • 急!!!!!!!(在线等待)
  • 急!在线等待!
  • 急!!(在线等待)
  • 急:在线等待!
  • 在线等待——急
  • 急!!!在线等待!!!

关键词

  • 字段
  • code
  • shcool
  • univ
  • gd
  • expert
  • confirm
  • person
  • exists
  • update

得分解答快速导航

  • 帖主:jackie8008
  • lialin
  • bzszp
  • hzf005
  • ORARichard
  • bluelamb

相关链接

  • Oracle类图书

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
北京创新乐知广告有限公司 版权所有, 京 ICP 证 070598 号
世纪乐知(北京)网络技术有限公司 提供技术支持
Copyright © 2000-2008, CSDN.NET, All Rights Reserved
GongshangLogo