First, the annual selection of Project statistics
--the annual selection of Project statistics,--content:--topic number Themeid, Version Impressions nthedition,nthpress, Project time Declaredate,--type (publication, reprint, reprint), topic Category 1, topic Category 2, Workshop (department)--Themetype 00 First edition, 01 reprint, 02 republication, 03 cooperation project--themetype1 Topic Category 1 01 reference map, 02 teaching aids, 03 books, 04 e-books, 05 special maps--themetype2 topic Category 2--Inteid Topic unique Id,statesname Current status--where Flowid = ' 200501060 ' indicates that the project has been completed and that the next process has been generated "departmental assignment". SelectA.themeid topic number,cast(a.nthedition as varchar)+'-'+cast(a.nthpress as varchar) version Impressions,Convert(varchar(Ten), A.declaredate, -) Project date, A.themetypename type, a.themetype1name Category 1, a.themetype2name Category 2, A.editorroomname Room, A.STATESN Ame current status,Convert(varchar(Ten), B.fagaodate, -) Date fromBw_theme A Left outer JoinBw_fagao b onA.inteid=B.themeinteidwhere exists(Select 1 fromBw_themetrack CwhereC.flowid='200501060' andC.themeid=A.inteid) andA.declaredate is not NULL and notA.themeid like 'c%'
Second, the difference between the left join in the SQL statement and the left outer join on, etc.
Http://www.cnblogs.com/cy163/archive/2008/10/16/1312920.html
Common SQL queries in Bianwu