您的位置:首页 > 博客中心 > 数据库 >

bianwu中的常用sql 查询

时间:2022-03-14 03:42

一、年度选题立项统计

--年度选题立项统计,
--内容:
--选题号themeid 、版印次nthedition,nthpress、立项时间declaredate、
--类型(出版、重印、再版)、选题类别1、选题类别2、编室(部门)
--themetype 00 初版, 01 再版,02 重版 ,03  合作项目
--themetype1 选题类别1  01 参考地图 ,02 教材教辅,03 图书,04 电子读物 ,05 特种地图 
--themetype2 选题类别2 
--inteid 选题唯一id,statesname 当前状态 
-- where flowid =‘200501060‘ 表示立项已完成,已经产生了下一步流程“部门分配”。

select 
    a.themeid 选题号,
    cast(a.nthedition as varchar)+‘-‘+cast(a.nthpress as varchar) 版印次,
    convert(varchar(10),a.declaredate,120) 立项日期,
    a.themetypename 类型,
    a.themetype1name 类别1,
    a.themetype2name 类别2,
    a.editorroomname 编室,
    a.statesname 当前状态,
    convert(varchar(10),b.fagaodate,120) 发稿日期
from bw_theme a left outer join bw_fagao b
on a.inteid =b.themeinteid
where exists(select 1 from bw_themetrack c where c.flowid =‘200501060‘ and c.themeid=a.inteid)
    and a.declaredate is not null
    and not a.themeid like ‘C%‘

 

二、sql语句中left join on 和left outer join on 等的区别

本类排行

今日推荐

热门手游