试图弄清楚如何在 select 语句中将整数和小数列转换为负数。任何帮助表示赞赏。
Begin
Select
OrderInvoiceHeader.Invoice_int As [Invoice #],
CustomerBillTo.BillToCustomerName As [Customer name],
OrderInvoiceHeader.Invoice_date As [Invoice date],
Salesmen.SalesmanName As [Salesman],
(Select
Cast(Round(SUM(BaleInventory.NetWeight_dec), 0) As int)
from dbo.BaleInventory
Where dbo.BaleInventory.BaleNumber In
(Select OrderInvoiceBales.BaleNumber
from OrderInvoiceBales
Where OrderInvoiceBales.Invoice_int = OrderInvoiceHeader.Invoice_int))
as [Lbs invoiced],
在这里我需要转换InvoiceAdjustment_dec
为负 if
OrderInvoiceHeader.InvoiceType = "3"
,其他美元值也是如此
OrderInvoiceHeader.InvoiceAdjustment_dec As [Adjustment $],
OrderInvoiceHeader.InvoiceFreight_dec As [Freight $],
OrderInvoiceHeader.InvoiceMerchandise_dec As [Merch $],
OrderInvoiceHeader.InvoiceTotal_dec As [Total $],
OrderInvoiceHeader.FreightPaid_dec As [Frt paid $]
From OrderInvoiceHeader
Left Outer Join dbo.CustomerBillTo
On OrderInvoiceHeader.BillToCustomer_int = CustomerBillTo.BillToCustomer_int
Left Outer Join dbo.Salesmen
On OrderInvoiceHeader.Salesman_int = Salesmen.Salesman_int
Where
OrderInvoiceHeader.Invoice_date >= @From_date and
OrderInvoiceHeader.Invoice_date <= @To_date
Order By OrderInvoiceHeader.Invoice_int
End