日期:2014-05-17 浏览次数:20475 次
create view ccc as
(select * from (
select CONVERT(varchar(100),a.Sub_ShipDate1,23) HS_Shipdate,a.TeamHandlingBy,a.JobNumber,a.Version,
a.Bill_to,a.Customer,a.JobName,a.Sub_Qty1 Quantity,
isnull(a.SetDeclareFactory,'待確認') SetDeclareFactory,
b.currency,b.unitprice_d,a.Sub_Qty1 Quantity1,a.Sub_Qty1*b.unitprice_d Total_Sales,
b.status,b.pcost,b.pcostratio from schedulingShipSchedule a, MailingPriceCalVH as b
where a.Sub_ShipDate1<>''and a.Sub_Qty1<>'' and a.JobNumber=b.ordernumber
and a.Version=b.versionno and a.TeamHandlingBy='Mailing'
union all
select CONVERT(varchar(100),a.Sub_ShipDate2,23) HS_Shipdate,a.TeamHandlingBy,a.JobNumber,a.Version,
a.Bill_to,a.Customer,a.JobName,a.Sub_Qty2 Quantity,
isnull(a.SetDeclareFactory,'待確認') SetDeclareFactory,
b.currency,b.unitprice_d,a.Sub_Qty2 Quantity1,a.Sub_Qty2*b.unitprice_d Total_Sales,
b.status,b.pcost,b.pcostratio from schedulingShipSchedule a, MailingPriceCalVH as b
where a.Sub_ShipDate2<>''and a.Sub_Qty2<>'' and a.JobNumber=b.ordernumber
and a.Version=b.versionno and a.TeamHandlingBy='Mailing'
)
as qqq order by JobNumber
)
CREATE VIEW [dbo].[View_1]
AS
SELECT TOP (100) PERCENT HS_Shipdate, TeamHandlingBy, JobNumber, Version, Bill_to, Customer, JobName, Quantity, SetDeclareFactory, currency,