修改一个xsjbdab的视图
增加了学生类别层次,还有本部与分校的字段,方便统计。
SELECT dbo.zyzb.zymc, dbo.zyjxjh.njzyid, dbo.bjxxb.bmc, dbo.dwdm.dwmc,
dbo.xbdm.xbmc, dbo.zyjxjh.xz AS xz1, dbo.xslb.xslbmc, dbo.zyzb.zyid AS zyid1,
dbo.xslb.cc AS cc, dbo.xjzt.xjztmc AS xjztmc, dbo.xsjbdab.xm, dbo.xsjbdab.bdm,
dbo.xsjbdab.xbdm, dbo.xsjbdab.dwdm, dbo.xsjbdab.jhid, dbo.xsjbdab.nj,
dbo.xsjbdab.lqbyh, dbo.xsjbdab.lqbhh, dbo.xsjbdab.dh, dbo.xsjbdab.bz,
dbo.xsjbdab.czn, dbo.xsjbdab.czy, dbo.xsjbdab.czr, dbo.xsjbdab.xh,
dbo.xsjbdab.xhjm, dbo.xsjbdab.xjztdm, dbo.xsjbdab.zsjj, dbo.xsjbdab.byrq,
dbo.xsjbdab.byzy, dbo.xsjbdab.byxx, dbo.xsjbdab.sfzh, dbo.xsjbdab.xslbdm,
CASE zsjj WHEN 1 THEN '春季' ELSE '秋季' END AS zsjjmc,
CASE xsjbdab.xslbdm WHEN 12 THEN '本科' ELSE '专科' END AS xslbcc,
CASE xsjbdab.dwdm WHEN 4420000 THEN '本部' ELSE '分校' END AS dw
FROM dbo.bjxxb INNER JOIN
dbo.xsjbdab ON dbo.bjxxb.bdm = dbo.xsjbdab.bdm INNER JOIN
dbo.dwdm ON dbo.bjxxb.dwdm = dbo.dwdm.dwdm INNER JOIN
dbo.xbdm ON dbo.xsjbdab.xbdm = dbo.xbdm.xbdm INNER JOIN
dbo.xslb ON dbo.xsjbdab.xslbdm = dbo.xslb.xslbdm INNER JOIN
dbo.xjzt ON dbo.xsjbdab.xjztdm = dbo.xjzt.xjztdm LEFT OUTER JOIN
dbo.zyjxjh INNER JOIN
dbo.njzy ON dbo.zyjxjh.njzyid = dbo.njzy.njzyid INNER JOIN
dbo.zyzb ON dbo.njzy.zyid = dbo.zyzb.zyid ON dbo.xsjbdab.jhid = dbo.zyjxjh.jhid
dbo.xbdm.xbmc, dbo.zyjxjh.xz AS xz1, dbo.xslb.xslbmc, dbo.zyzb.zyid AS zyid1,
dbo.xslb.cc AS cc, dbo.xjzt.xjztmc AS xjztmc, dbo.xsjbdab.xm, dbo.xsjbdab.bdm,
dbo.xsjbdab.xbdm, dbo.xsjbdab.dwdm, dbo.xsjbdab.jhid, dbo.xsjbdab.nj,
dbo.xsjbdab.lqbyh, dbo.xsjbdab.lqbhh, dbo.xsjbdab.dh, dbo.xsjbdab.bz,
dbo.xsjbdab.czn, dbo.xsjbdab.czy, dbo.xsjbdab.czr, dbo.xsjbdab.xh,
dbo.xsjbdab.xhjm, dbo.xsjbdab.xjztdm, dbo.xsjbdab.zsjj, dbo.xsjbdab.byrq,
dbo.xsjbdab.byzy, dbo.xsjbdab.byxx, dbo.xsjbdab.sfzh, dbo.xsjbdab.xslbdm,
CASE zsjj WHEN 1 THEN '春季' ELSE '秋季' END AS zsjjmc,
CASE xsjbdab.xslbdm WHEN 12 THEN '本科' ELSE '专科' END AS xslbcc,
CASE xsjbdab.dwdm WHEN 4420000 THEN '本部' ELSE '分校' END AS dw
FROM dbo.bjxxb INNER JOIN
dbo.xsjbdab ON dbo.bjxxb.bdm = dbo.xsjbdab.bdm INNER JOIN
dbo.dwdm ON dbo.bjxxb.dwdm = dbo.dwdm.dwdm INNER JOIN
dbo.xbdm ON dbo.xsjbdab.xbdm = dbo.xbdm.xbdm INNER JOIN
dbo.xslb ON dbo.xsjbdab.xslbdm = dbo.xslb.xslbdm INNER JOIN
dbo.xjzt ON dbo.xsjbdab.xjztdm = dbo.xjzt.xjztdm LEFT OUTER JOIN
dbo.zyjxjh INNER JOIN
dbo.njzy ON dbo.zyjxjh.njzyid = dbo.njzy.njzyid INNER JOIN
dbo.zyzb ON dbo.njzy.zyid = dbo.zyzb.zyid ON dbo.xsjbdab.jhid = dbo.zyjxjh.jhid