
1
create view storeDifferentiation(requestid,lcbh,sqr,unfinished,finished) as select b.requestid,b.lcbh,b.sqr,b.unfinished,a.finished
from(select h.requestid,h.lcbh,h.sqr,(count(d.mdbm)) as finished from formtable_main_586 h,formtable_main_586_dt2 d,workflow_requestbase w where h.id=d.mainid and d.xfrq is not null and w.requestid= h.requestid and w.currentnodetype = '3' group by h.requestid,h.lcbh,h.sqr)a
full join
(select h.requestid,h.lcbh,h.sqr,(count(d.mdbm)) as unfinished from formtable_main_586 h,formtable_main_586_dt2 d,workflow_requestbase w where h.id=d.mainid and d.xfrq is null and w.requestid= h.requestid and w.currentnodetype = '3' group by h.requestid,h.lcbh,h.sqr)b
on a.requestid=b.requestid
本文详细介绍了使用SQL创建视图的方法,通过一个具体的例子展示了如何从多个表中选择并组合数据,形成一个新视图,以实现数据的高效管理和查询。文章深入探讨了SQL语句的结构和语法,为数据库管理员和开发者提供了实用的指导。
780

被折叠的 条评论
为什么被折叠?



