select c.RecID as id,c.ItemNum,i.Descr as ItemDescr,c.Op,r.Comments as OpDescr,c.ItemCode,c.Descr,c.IsMain --c.Typed,g.Comments as TypedDescr,
	from ItemOpCondition c
	left join ItemMaster i
	on c.Domain=i.Domain and c.ItemNum=i.ItemNum
	left join GeneralizedCodeMaster r
	on c.Domain=r.Domain and r.FldName ='PrevProcessOp' and c.Op=r.Val
	--left join GeneralizedCodeMaster g
	--on c.Domain=g.Domain and c.Typed=g.Val and g.FldName='PrevOpConditionType'
	where c.Domain='{<UserFactoryNum>}' and c.CodeType= 'PrevProcess'