1.使用update进行数据更新 1)最简单的更新 update tablea a set a.price=1.00 2)带条件的数据更新 update tablea a set a.price = 2.00 where a.id='02' 3)两张表关联更新为固定值 update tablea a set a.price =3.00 where exits(select 1 from tableb b where a.id=b.id) 将a,b相同id的 a表的price 字段更新为 3.
1.sql2000中只能用自定义的函数解决 )) , 'aa') , 'bb') , 'aaa') , 'bbb') , 'ccc') go )) ) as begin ) select @str = isnull(@str + ',' , '') + cast(value as varchar) from tb where id = @id return @str end go --调用函数 select id , value = dbo.f_str(id) from tb group by
Sql代码 select t.rank, t.Name from t_menu_item t; 10 CLARK 10 KING 10 MILLER 20 ADAMS 20 FORD 20 JONES 20 SCOTT 20 SMITH 30 ALLEN 30 BLAKE 30 JAMES 30 MARTIN 30 TURNER 30 WARD -------------------------------- 我们通过