Description
Properties
| Name | Value |
|---|---|
| Collation | |
| ANSI Nulls ON | True |
| Quoted Identifier ON | True |
| Encrypted | False |
| Schema Bound | False |
| Created | 9/11/2017 10:52:06 |
| Last Modified | 9/11/2017 10:52:06 |
Columns
| Key | Name | Description |
|---|---|---|
| ms_production_in_detail_id | ||
| out_qty | ||
| plan_qty |
SQL Script
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
create view dbo.vw_ms_production_in_sum_to_memo
---XencX---with encryption
as
SELECT dt_ms_memo_detail_supply.supply_id_source AS ms_production_in_detail_id
,sum(case when dt_ms_memo_header_h_status.ms_memo_header_status_id = 1 then dt_ms_memo_detail_supply.quantity else 0 end ) out_qty
,sum(case when dt_ms_memo_header_h_status.ms_memo_header_status_id = 0 then dt_ms_memo_detail_supply.quantity else 0 end ) plan_qty
FROM dt_ms_memo_detail_supply INNER JOIN
dt_ms_memo_detail ON dt_ms_memo_detail_supply.ms_memo_detail_id = dt_ms_memo_detail.ms_memo_detail_id INNER JOIN
dt_ms_memo_header ON dt_ms_memo_detail.ms_memo_header_id = dt_ms_memo_header.ms_memo_header_id INNER JOIN
dt_ms_memo_header_h_status ON dt_ms_memo_header.ms_memo_header_h_status_id = dt_ms_memo_header_h_status.ms_memo_header_h_status_id
WHERE (dt_ms_memo_detail_supply.supply_mode_source = 1)
GROUP BY dt_ms_memo_detail_supply.supply_id_source
GO
GO
create view dbo.vw_ms_production_in_sum_to_memo
---XencX---with encryption
as
SELECT dt_ms_memo_detail_supply.supply_id_source AS ms_production_in_detail_id
,sum(case when dt_ms_memo_header_h_status.ms_memo_header_status_id = 1 then dt_ms_memo_detail_supply.quantity else 0 end ) out_qty
,sum(case when dt_ms_memo_header_h_status.ms_memo_header_status_id = 0 then dt_ms_memo_detail_supply.quantity else 0 end ) plan_qty
FROM dt_ms_memo_detail_supply INNER JOIN
dt_ms_memo_detail ON dt_ms_memo_detail_supply.ms_memo_detail_id = dt_ms_memo_detail.ms_memo_detail_id INNER JOIN
dt_ms_memo_header ON dt_ms_memo_detail.ms_memo_header_id = dt_ms_memo_header.ms_memo_header_id INNER JOIN
dt_ms_memo_header_h_status ON dt_ms_memo_header.ms_memo_header_h_status_id = dt_ms_memo_header_h_status.ms_memo_header_h_status_id
WHERE (dt_ms_memo_detail_supply.supply_mode_source = 1)
GROUP BY dt_ms_memo_detail_supply.supply_id_source
GO