Home > database >  If according to the name associated with interval unit price
If according to the name associated with interval unit price

Time:01-27

Began to outer diameter end interval unit price commodity diameter
Aluminum 0.1 0.5 1
Aluminum 1 2 2
Copper 0.2 0.6 2
Copper 0.7 1 5


How to query the



Unit price commodity diameter
Aluminum 0.3
Aluminum 1.2
Copper 0.5

How to query the price

ALTER the FUNCTION [dbo] [f_GetSellOutPrice] (@ F_ItemName varchar (50), @ F_Spec varchar (50))
RETURNS a decimal (18, 6) AS
The BEGIN
Declare @ strUnit varchar (50)
Select @ strUnit=F_Price from V_SellOrderFeeDetail where F_ItemName=@ F_ItemName and isnull (F_MinSpec, '0') & lt;=@ F_spec and isnull (F_MaxSpec, '0') & gt;=@ F_spec and F_Person=@ F_Person
-
Return the @ strUnit
END

The select dbo. F_GetSellOutPrice (F_ItemName F_Spec) from V_SellOutDetail

For now, just the speed is too slow, have what better way to

CodePudding user response:

SELECT
B. *,
Amy polumbo RICE
The FROM
V_SellOutDetail B
LEFT the JOIN
V_SellOrderFeeDetail A
ON
A.F _MinSpec & lt;=b. _Spec AND A.F _MaxSpec & gt;=b. _Spec
AND A.F _ItemName=b. _ItemName
  • Related