SQL中如何用一个表更新另一个表
for ACCESS :
update a, b set a.name=b.name1 where a.id=b.id
for SQL Server:
"update a set a.name=b.name1 from a,b where a.id=b.id"
update a set a.status=b.status
from table1 a,table2 b
where a.id1=b.id1
update a inner join b on a.a1=b.b1 set a.a2=b.b2条件
update table1 set a.status = b.status
from table1 a inner join table2 b
on a.idl = b.idl
http://topic.csdn.net/t/20041013/14/3451961.html
http://www.cnblogs.com/hanguoji/archive/2007/02/01/636723.aspx
相关文档:
Sql时间函数
一、sql server日期时间函数
Sql Server中的日期与时间函数
1. 当前系统日期、时间
select getdate()
2. dateadd 在向指定日期加上一段时间的基础上,返回新的 datetime 值
......
SQL Server:
Select TOP N * from TABLE Order By NewID()
Select TOP N * from TABLE Order By NewID()
NewID()函数将创建一个 uniqueidentifier 类型的唯一值。上面的语句实现效果是从Table中随机读取N条记录。
Access:
Select TOP N *&n ......
Sql Server2005的一个新特性便是我等了很久的Row_Number(),以前用Oracle时用rownumber写分页存储过程很方便:)
下面是我做的一个小小的测试,测试我原来在sql server2000下所用的分页存储过程与使用Row_Number()编写的存储过程在Sql Server2005上的执行效率...
数据表:
REATE TABLE [dbo].[test](
[UserId] [int] Pri ......
1、 用程序中,保证在实现功能的基础上,尽量减少对数据库的访问次数;通过搜索参数,尽量减少对表的访问行数,最小化结果集,从而减轻网络负担;能够分开的操作尽量分开处理,提高每次的响应速度;在数据窗口使用SQL时,尽量把使用的索引放在选择的首列;算法的结构尽量简单;在查询时,不要过多地使用 ......