USE [期日前当日投票_STD]

GO

CREATE VIEW [F表記期日前マスタ]
AS 
SELECT * FROM [汎用マスタ]
WHERE ([ID] = 'FNC10')

GO

CREATE VIEW [F表記当日マスタ]
AS 
SELECT * FROM [汎用マスタ]
WHERE ([ID] = 'FNC20')

GO

CREATE VIEW [バーコード設計マスタ]
AS 
SELECT * FROM [汎用マスタ]
WHERE ([ID] = 'BCD00')

GO

CREATE VIEW [ホスト変換受付区分マスタ]
AS 
SELECT * FROM [汎用マスタ]
WHERE ([ID] = 'SCHR7')

GO

CREATE VIEW [ホスト変換投票状態マスタ]
AS 
SELECT * FROM [汎用マスタ]
WHERE ([ID] = 'SCH12')

GO

CREATE VIEW [ホスト変換名簿区分マスタ]
AS 
SELECT * FROM [汎用マスタ]
WHERE ([ID] = 'SCH25')

GO

CREATE VIEW [ラベルレイアウトマスタ]
AS 
SELECT * FROM [汎用マスタ]
WHERE ([ID] = 'LBL00')

GO

CREATE VIEW [ラベル項目マスタ]
AS 
SELECT * FROM [汎用マスタ]
WHERE ([ID] = 'LBM00')

GO

CREATE VIEW [異動事由マスタ]
AS 
SELECT * FROM [汎用マスタ]
WHERE ([ID] LIKE 'CHR__')

GO

CREATE VIEW [異動事由一般マスタ]
AS 
SELECT * FROM [汎用マスタ]
WHERE ([ID] = 'CHR01')

GO

CREATE VIEW [異動事由海区マスタ]
AS 
SELECT * FROM [汎用マスタ]
WHERE ([ID] = 'CHR21')

GO

CREATE VIEW [異動事由国民マスタ]
AS 
SELECT * FROM [汎用マスタ]
WHERE ([ID] = 'CHR91')

GO

CREATE VIEW [異動事由財産マスタ]
AS 
SELECT * FROM [汎用マスタ]
WHERE ([ID] = 'CHR31')

GO

CREATE VIEW [異動事由住基マスタ]
AS 
SELECT * FROM [汎用マスタ]
WHERE ([ID] = 'CHR00')

GO

CREATE VIEW [異動事由抄本表記マスタ]
AS 
SELECT * FROM [汎用マスタ]
WHERE ([ID] = 'CHT00')

GO

CREATE VIEW [異動事由短縮マスタ]
AS 
SELECT * FROM [汎用マスタ]
WHERE ([ID] = 'CHS00')

GO

CREATE VIEW [異動事由土地マスタ]
AS 
SELECT * FROM [汎用マスタ]
WHERE ([ID] = 'CHR41')

GO

CREATE VIEW [異動事由農業マスタ]
AS 
SELECT * FROM [汎用マスタ]
WHERE ([ID] = 'CHR11')

GO

CREATE VIEW [管理マスタ]
AS 
SELECT * FROM [汎用マスタ]
WHERE ([ID] = 'SET00')

GO

CREATE VIEW [期日前代理補助者マスタ]
AS 
SELECT * FROM [汎用マスタ]
WHERE ([ID] LIKE 'PVH11')

GO

CREATE VIEW [期日前帳票カスタマイズ関連マスタ]
AS 
SELECT * FROM [汎用マスタ]
WHERE ([ID] LIKE 'PBT05')

GO

CREATE VIEW [期日前帳票その他関連マスタ]
AS 
SELECT * FROM [汎用マスタ]
WHERE ([ID] LIKE 'PBT04')

GO

CREATE VIEW [期日前帳票リスト関連マスタ]
AS 
SELECT * FROM [汎用マスタ]
WHERE ([ID] LIKE 'PBT01')

GO

CREATE VIEW [期日前帳票提出書類関連マスタ]
AS 
SELECT * FROM [汎用マスタ]
WHERE ([ID] LIKE 'PBT03')

GO

CREATE VIEW [期日前帳票統計関連マスタ]
AS 
SELECT * FROM [汎用マスタ]
WHERE ([ID] LIKE 'PBT02')

GO

CREATE VIEW [指定投票区マスタ]
AS 
SELECT * FROM [汎用マスタ]
WHERE ([ID] = 'SPC00')

GO

CREATE VIEW [自治体情報マスタ]
AS 
SELECT * FROM [汎用マスタ]
WHERE ([ID] = 'USR00')

GO

CREATE VIEW [執行日IDマスタ]
AS 
SELECT * FROM [汎用マスタ]
WHERE ([ID] = 'EXD00')

GO

CREATE VIEW [執行日別施設別不在交付件数]
AS 
SELECT * FROM [汎用マスタ]
WHERE ([ID] = 'SCT00')

GO

CREATE VIEW [速報集計時刻マスタ]
AS 
SELECT * FROM [汎用マスタ]
WHERE ([ID] = 'TIM10')

GO

CREATE VIEW [速報集計時刻当日マスタ]
AS 
SELECT * FROM [汎用マスタ]
WHERE ([ID] = 'TIM20')

GO

CREATE VIEW [帳票レイアウトマスタ]
AS 
SELECT * FROM [汎用マスタ]
WHERE ([ID] = 'PLY00')

GO

CREATE VIEW [投票状態抄本表記マスタ]
AS 
SELECT * FROM [汎用マスタ]
WHERE ([ID] = 'TJO00')

GO

CREATE VIEW [当日代理補助者マスタ]
AS 
SELECT * FROM [汎用マスタ]
WHERE ([ID] = 'PVH22')

GO

CREATE VIEW [当日帳票状況関連マスタ]
AS 
SELECT * FROM [汎用マスタ]
WHERE ([ID] LIKE 'PBT11')

GO

CREATE VIEW [当日帳票投票数関連マスタ]
AS 
SELECT * FROM [汎用マスタ]
WHERE ([ID] LIKE 'PBT12')

GO

CREATE VIEW [当日不在者代理補助者マスタ]
AS 
SELECT * FROM [汎用マスタ]
WHERE ([ID] LIKE 'PVH21')

GO

CREATE VIEW [年代マスタ]
AS 
SELECT * FROM [汎用マスタ]
WHERE ([ID] = 'AGE10')

GO

CREATE VIEW [不可能選挙マスタ]
AS 
SELECT * FROM [汎用マスタ]
WHERE ([ID] = 'ELT00')

GO

CREATE VIEW [異動事由コードマスタ]
 AS
 SELECT l.[c_key]AS[名簿区分],(0)AS[異動事由種別],m.[CodeI]AS[異動事由コード],m.[CodeS]AS[ホストコード],m.[DataI]AS[優先順位],m.[DataS]AS[名称],s.[DataS]AS[短縮名],t.[DataS]AS[抄本表記]
 FROM (([異動事由住基マスタ] m INNER JOIN [名簿区分マスタ] l ON m.[CodeI]IS NOT NULL)LEFT OUTER JOIN [異動事由短縮マスタ] s ON m.[ID]=s.[CodeS] AND m.[CodeI]=s.[CodeI]
 LEFT OUTER JOIN [異動事由抄本表記マスタ] t ON m.[ID]=t.[CodeS] AND m.[CodeI]=t.[CodeI])
 UNION 
 SELECT LEFT(RIGHT(m.[ID],2),1)AS[名簿区分],(1)AS[異動事由種別],m.[CodeI]AS[異動事由コード],m.[CodeS]AS[ホストコード],m.[DataI]AS[優先順位],m.[DataS]AS[名称],s.[DataS]AS[短縮名],t.[DataS]AS[抄本表記]
 FROM ([汎用マスタ] m LEFT OUTER JOIN [異動事由短縮マスタ] s ON m.[ID]=s.[CodeS] AND m.[CodeI]=s.[CodeI])
 LEFT OUTER JOIN [異動事由抄本表記マスタ] t ON m.[ID]=t.[CodeS] AND m.[CodeI]=t.[CodeI]
 WHERE m.[ID] LIKE 'CHR_1'

GO

CREATE VIEW [ホスト変換投票事由マスタ]
AS 
SELECT * FROM [汎用マスタ]
WHERE ([ID] = 'SCH04')

GO

CREATE VIEW [ホスト変換選挙人属性マスタ]
AS 
SELECT * FROM [汎用マスタ]
WHERE ([ID] = 'SCH15')

GO

CREATE VIEW [ホスト変換不在請求区分マスタ]
AS 
SELECT * FROM [汎用マスタ]
WHERE ([ID] = 'SCHR4')

GO

CREATE VIEW [清音変換マスタ]
AS 
SELECT [CodeI] AS [適用順], [CodeS] AS [変換前], [DataS] AS [変換後], [DataI] AS [Optional], * FROM [汎用マスタ] 
WHERE ([ID]='NRM00')

GO
