SELECT TC.ConfinenceNo,TP.FDisplayName as CreatorPerson,TC.CreateTime,TD.FDisplayName as FenBao,TC.InceptPerson,TC.InceptDate,'查看' as Sel
FROM AM_TCONTINENCE TC
join TPerson TP on TP.FID=TC.OperatorID
join TDept TD on TD.FID=TC.SubFenBao
order by TC.ConfinenceNo
select TU.ID,TU.MaterialNo,TM.MaterialName,TMT.MaterialTypeName,
case when TM.SpecCode is not null then '规格代号:'+TM.SpecCode+'; ' ELSE '' END+case when TC.FValue is not null then '选用标准:'+TC.FValue ELSE '' END
+case when TMA.RawNature is not null then '材质:'+TMA.RawNature+'; ' ELSE '' END+case when TU.Page is not null then '页次:'+TU.page else '' end
as Descriptions,TU.Quantity,TCC.FValue as Unit,TM.Weight,TU.Remark,TU.ProcmOrderID
from AM_TMATUSELIST TU
join AM_TMATERIAL TM on (TU.LinkType=1 and TU.LinkedID=TM.ID ) or (TU.LinkType=0 and TU.MaterialNo=TM.MaterialNo)
join AM_TMATERIALTYPE TMT on TM.MatTypeID=TMT.ID
left join AM_TConfig TC on TM.SelectedStandard=TC.FKey and TC.FType='选用标准'
left join AM_TConfig TCC on TM.Unit=TCC.FKey and TCC.FType='计量单位'
left join AM_TMATERIALNATURE TMA on TM.RawNatureID=TMA.ID
where TU.ProcmOrderID like 'Z%'
把这两个sql用用到的表都传上来吧 |