1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
| USE [cool]
| GO
|
| /****** Object: View [dbo].[asr_loc_use_view] Script Date: 2020/6/15 9:45:48 ******/
| SET ANSI_NULLS ON
| GO
|
| SET QUOTED_IDENTIFIER ON
| GO
|
|
| create view [dbo].[asr_loc_use_view] as
| select SUM(fqty) fqty,SUM(oqty) oqty,SUM(uqty) uqty,SUM(xqty) xqty
| from (
| select COUNT(*) fqty,0 oqty,0 uqty,0 xqty from asr_loc_mast
| where loc_sts='F' or loc_sts='D'
| union all
| select 0,COUNT(*),0,0 from asr_loc_mast
| where loc_sts='O'
| union all
| select 0,0,COUNT(*),0 from asr_loc_mast
| where loc_sts='P' or loc_sts='Q' or loc_sts='R' or loc_sts='S'
| union all
| select 0,0,0,COUNT(*) from asr_loc_mast
| where loc_sts='X'
| ) a
|
|
| GO
|
|