码迷,mamicode.com
首页 > 数据库 > 详细

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

时间:2016-05-18 14:30:53      阅读:187      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!