SQL——实例记录(exists、distinct)
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 用来去重复