NJC__Documentation::DB

dbo.vw_ms_production_retur_header_count_detail

Description

Properties

Name Value
Collation
ANSI Nulls ON

True

Quoted Identifier ON

True

Encrypted

False

Schema Bound

False

Created 9/11/2017 10:52:58
Last Modified 9/11/2017 10:52:58

Columns

Key Name Description
ms_production_retur_id
max_doc_date
count_adjusment_avg
count_item

SQL Script

SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
create view dbo.vw_ms_production_retur_header_count_detail
---XencX---with encryption
as   

SELECT      
 dt_ms_production_retur_detail.ms_production_retur_id
, max(vw_ms_production_in_detail.doc_date) as max_doc_date
,SUM(case when  not(isnull(dt_ms_production_retur.approve_ms_cost_final_avg_id,-1)=isnull(vw_ms_production_in_detail.approve_ms_cost_final_avg_id,-1)) then 1 else 0 end) as count_adjusment_avg
,count(*) as count_item 
FROM            dt_ms_production_retur_detail INNER JOIN
                         vw_ms_production_in_detail ON dt_ms_production_retur_detail.ms_item_out_detail_id = vw_ms_production_in_detail.ms_production_in_detail_id INNER JOIN
                         dt_ms_production_retur ON dt_ms_production_retur_detail.ms_production_retur_id = dt_ms_production_retur.ms_production_retur_id 
  group by dt_ms_production_retur_detail.ms_production_retur_id   
GO