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'
相关文档:
--语 句 功 能
1、数据操作
Select --从数据库表中检索数据行和列
Insert & ......
Transact-SQL 提供了(BEGIN...END、BREAK、GOTO、CONTINUE、IF...ELSE、WHILE、RETURN、WAITFOR)控制流关键字,用于控制 Transact-SQL 语句、语句块、用户定义函数以及存储过程的执行流。 不使用控制流语言,则各 Transact-SQL 语句按其出现的顺序分别执行。控制流语言使用与程序设计相似的构造使语句得以互相连接、关联和 ......
一
SQL重复记录查询(转自http://blog.csdn.net/RainyLin/archive/2009/02/17/3901956.aspx)
SQL重复记录查询
1、查找表中多余的重复记录,重复记录是根据单个字段(peopleId)来判断
select * from people
where peopleId in (select peopleId from people group ......
SQL重复记录查询
1、查找表中多余的重复记录,重复记录是根据单个字段(peopleId)来判断
select * from
people
where peopleId in (select peopleId from people group by peopleId
having count
(peopleId) > 1)
2、删除表中多余的重复记录,重复记录是根据单个字段(p ......