求一条sql语句
a表:字段:科目id,科目名称
b表:字段:b_id,科目id,成绩
用一条sql语句来实现:将b表中的科目名称为数据结构的成绩底于59分的都改为60分 谢谢qiu
问题点数:10、回复次数:4Top
1 楼lizheng__114(浪淘沙)回复于 2005-08-03 14:10:33 得分 10
update b表 set 成绩='60' where 成绩<'59' and id in (select id from a表 where 科目名称='数据结构')Top
2 楼tanjy(tanjy)回复于 2005-08-03 14:16:04 得分 0
update b
set result=60
where result<=59 and id=(select id from a where Name='数据结构')
不难啊
QQ330524561Top
3 楼lm9764(李)回复于 2005-08-03 14:43:33 得分 0
update test2 set grade='60' where id in(
select test2.id
from test1, test2
where test1.id = test2.id and grade < '59' and test1.name = '数据结构'
)Top
4 楼terry52(天天在线)回复于 2005-08-03 14:54:15 得分 0
update b
set result=60
where result<=59 and id=(select id from a where Name='数据结构')
这个应该不可以的,要这样写的话还是参照第一位说的吧。Top




