SQL联表更新,联表查询
没有引用关系的表
1. 联表更新
update a set a.education = '本科' from NT_UserInfo a ,NT_User b where a.UserID=b.UserID and b.email = 'carlfan2008@163.com'
2. 联表查询
select a.*,b.* from nt_user as a, nt_userinfo as b where a.userid = b.userid and Email = 'carlfan2008@163.com'
相关文档:
数据库事务是其他事务模型的基础,当一个事务创建时不同数据库系统都有自己的规
则。SQL Server 默认在自动提交的模式下工作,每个语句执行完后都会立即提交;与此对照
的是 Oracle 需要你包含一个提交语句。但是当一个语句通过 OLE DB 执行时,它执行完后
一个提交动作会被附加上去。例如:
DECLARE  ......
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
/// <summary>
/ ......
Oracle中的递归查询可以依靠增强的sql语句START WITH ...CONNECT BY PRIOR来搞定.sql 2005中不支持该语句,以下示例可以实现递归查询.
WITH TREE(xzdm,Prexzdm,lvl,topxzdm)
AS
(
SELECT xzdm,prexzdm,1,prexzdm as topxzdm from xzdm WHERE Prexzdm = '000000000000'
&nbs ......
SQL重复记录查询
1、查找表中多余的重复记录,重复记录是根据单个字段(peopleId)来判断
select * from
people
where peopleId in (select peopleId from people group by peopleId
having count
(peopleId) > 1)
2、删除表中多余的重复记录,重复记录是根据单个字段(p ......