123456789101112131415161718192021222324252627282930313233343536373839404142 |
-
- GO
- /****** 对象: View [dbo].[qjview] 脚本日期: 05/18/2015 09:57:45 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- ------------------------------------------------------------------------
- create view [dbo].[qjview1] as select
- dbo.dindan.id, -- 订单号;
- dbo.dindan.name2, -- 姓名2;
- dbo.dindan.name1, -- 姓名1;
- dbo.dindansp.name, -- 订单商品名;
- dbo.shangpin.spjiage3, -- 商品制作费用 2015-05-18 暂时在视图显示-但是若shangpin表里没有spid,会造成有缺;
- dbo.dindansp.shuliang, -- 订单商品数量;
- dbo.dindansp.status4, -- 返工原因(命名有歧义)
- dbo.dindansp.date2, -- 返工日期
- dbo.dindansp.status1, -- 制作完成状态
- dbo.dindansp.date3, -- 完成日期
- dbo.dindansp.status3 -- 发出(至制作家)
- from dbo.dindan
- INNER JOIN dbo.dindansp ON dbo.dindan.id = dbo.dindansp.id
- INNER JOIN dbo.shangpin ON dbo.dindansp.spid = dbo.shangpin.spid
- -- 不可行,有缺;
- ------------------------------------------------------------------------
- create view [dbo].[qjview] as select
- dbo.dindan.id, -- 订单号;
- dbo.dindan.name2, -- 姓名2;
- dbo.dindan.name1, -- 姓名1;
- dbo.dindansp.name, -- 订单商品名;
- -- 商品制作费用 2015-05-18 暂时在视图显示;
- (select spjiage3 from dbo.shangpin where spid = dbo.dindansp.spid) as prodcosts,
- dbo.dindansp.shuliang, -- 订单商品数量;
- dbo.dindansp.status4, -- 返工原因(命名有歧义)
- dbo.dindansp.date2, -- 返工日期
- dbo.dindansp.status1, -- 制作完成状态
- dbo.dindansp.date3, -- 完成日期
- dbo.dindansp.status3 -- 发出(至制作家)
- from dbo.dindan
- INNER JOIN dbo.dindansp ON dbo.dindan.id = dbo.dindansp.id
- -- 可行方案;
- ------------------------------------------------------------------------
|