union all select 'J937', '染色'declare @b table(code varchar(10),type varchar(10))
insert @b select 'J935', '染' union all select 'J936', '染'
union all select 'J937', '光' select (select count(*) from(select * from @a union all select * from @b) b where b.code=a.code and b.type>=a.type) as 名次,* from (select * from @a union all select * from @b) a order by code,cx 名次 1 J935 新眼 2 J935 染 1 J936 新制 2 J936 染 1 J937 新眼 2 J937 染色 3 J937 光
不是,我的意思是我现在用ado控件执行了一个合并结果集的查询,例如select 学号,综合分,专业名次 from a union select 学号,综合分,专业名次 from b order by 综合分 然后我想将专业名次这个字段的值改为1。2。3。4。5。 但是我发现只能修改表a中的数据,表b中的却无法修改,这是怎么回事?
insert @a select 'J935', '新眼'
union all select 'J936', '新制'
union all select 'J937', '新眼'
union all select 'J937', '染色'declare @b table(code varchar(10),type varchar(10))
insert @b select 'J935', '染' union all select 'J936', '染'
union all select 'J937', '光' select (select count(*) from(select * from @a union all select * from @b) b where b.code=a.code and b.type>=a.type) as 名次,* from
(select * from @a union all select * from @b)
a order by code,cx 名次
1 J935 新眼
2 J935 染
1 J936 新制
2 J936 染
1 J937 新眼
2 J937 染色
3 J937 光
然后我想将专业名次这个字段的值改为1。2。3。4。5。
但是我发现只能修改表a中的数据,表b中的却无法修改,这是怎么回事?