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

sql with 写法

时间:2017-09-12 18:33:16      阅读:158      评论:0      收藏:0      [点我收藏+]

标签:and   select   group   sel   assign   sig   history   ssi   sql   

with h_asign_id as (
select asign_id from assign_h h
left join assignment a on a.id = h.asign_id
where 1=1
group by h.asign_id
)

select h.asign_id from assign_history h, h_asign_id i
where  
h.id in ( select max(assign_h.id) from assign_h where assign_hasign_id = h.asign_id)
and
h.asign_id = i.asign_id

sql with 写法

标签:and   select   group   sel   assign   sig   history   ssi   sql   

原文地址:http://www.cnblogs.com/yingjie13/p/7511377.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!