首页 > 数据库技术 > 详细

SQL——实例记录(exists、distinct)

时间:2016-05-18 14:30:30      阅读:200      评论:0      收藏:0      [点我收藏+]

use db--指向操作的数据库

go --批处理标识,要来标识以上为整个语句块供服务器解析
if exists (select 序号 from 进度总表 where 包装时间 is not null and 压力时间 is null) --如果有返回值就执行下面的语句,没有不执行
update 进度总表 set 压力时间=‘2016-5-17‘ where 序号 in(select 序号 from 进度总表 where 包装时间 is not null and 压力时间 is null)
go

select distinct 单号  from 数据源  --distinct 用来去重复

 

SQL——实例记录(exists、distinct)

原文:http://www.cnblogs.com/kaiwensievert/p/5504839.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!