关于update的很急的问题在线等待,解决了给100分
有两个表
一个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




