WITH WER AS ( SELECT INVESTIGATION_DATE AS 调查时间, JOCKEY AS 操作工, SHIFT AS 班次, PRODUCT_TYPE AS 产品类型, INSPECTION_STAGE AS 检验阶段, HOLE_AREA AS 孔洞区域, HOLE_QUANTITY AS 孔洞数量 FROM WR_ET_QUALITY_HOLE), QWR AS( SELECT DISTINCT MDM_TIME.FWEEK AS 周, MDM_TIME.FMONTH AS 月, WR_ET_QUALITY_HOLE.INVESTIGATION_DATE 日期 FROM WR_ET_QUALITY_HOLE LEFT JOIN MDM_TIME ON WR_ET_QUALITY_HOLE.INVESTIGATION_DATE = MDM_TIME.FYMDAY) SELECT WER.操作工, WER.检验阶段, WER.孔洞区域, WER.孔洞数量, WER.班次, WER.产品类型, QWR.周, QWR.月 FROM WER LEFT JOIN QWR ON WER.调查时间= QWR.日期 |