0
SQLクエリを必要とする:私はこのようなSQLクエリ持っているこの形式
SELECT '2015' as year,
T0.ItemCode as 'Item Code',
T1.Price As 'Base Price',
T2.Amount As 'Box qty',
T2.Price As 'Box Price'
FROM OITM T0
Inner Join SPP1 T1 on T0.ItemCode=T1.ItemCode
Inner Join SPP2 T2 on T0.ItemCode=T2.ItemCode And T1.LINENUM=T2.SPP1LNum
Where T0.ItemCode ='V0724-0158'
and FromDate ='20150101'
and ToDate ='20160315'
:私は別の比較クエリを持って
ItemCode ItemName Quantity InvntryUom Price
-------------------- ---------------------------------------------------------------------------------------------------- --------------------------------------- ---------------------------------------------------------------------------------------------------- ---------------------------------------
V0724-0158 SIS'88 80326 Brown Sugar 1kg Bag (Arabic) SBRADK124C - PET12/LLDPE60, 410mm x 1000m x 8-9C 29.000000 Roll 232.390000
V0724-0158 SIS'88 80326 Brown Sugar 1kg Bag (Arabic) SBRADK124C - PET12/LLDPE60, 410mm x 1000m x 8-9C 29.000000 Roll 232.390000
V0724-0158 SIS'88 80326 Brown Sugar 1kg Bag (Arabic) SBRADK124C - PET12/LLDPE60, 410mm x 1000m x 8-9C 10.000000 Roll 234.740000
:
select T2.ItemCode,
T2.ItemName,
T1.Quantity,
T2.InvntryUom,
T1.Price
from opor T0
inner join por1 T1 on T1.DocEntry = T0.DocEntry
inner join OITM T2 on T2.ItemCode = T1.ItemCode
where T1.ItemCode = 'V0724-0158'
and month(T0.DocDueDate) in (4,5, 6) and year(T0.DocDueDate) = '2016'
出力は次のようです出力は次のようになります。
year Item Code Base Price Box qty Box Price
---- -------------------- --------------------------------------- --------------------------------------- ---------------------------------------
2015 V0724-0158 242.000000 16.000000 242.000000
2015 V0724-0158 242.000000 25.000000 239.580000
2015 V0724-0158 242.000000 50.000000 235.000000
2015 V0724-0158 242.000000 100.000000 230.000000
サンプルの出力結果は、ボックスと呼ばれる黄褐色の追加の列と次のようになりquanity列が下2番目のクエリのボックスquanittyと比較するべきである最初のクエリで
が第二のクエリ
for eg: if quantity is 10 the box price is 242
if quantity is 29 the box price is 239.58
に確認するための条件であります価格:
ItemCode ItemName Quantity InvntryUom Price Box Price
-------------------- ---------------------------------------------------------------------------------------------------- --------------------------------------- ---------------------------------------------------------------------------------------------------- ----------------------------------------------------
V0724-0158 SIS'88 80326 Brown Sugar 1kg Bag (Arabic) SBRADK124C - PET12/LLDPE60, 410mm x 1000m x 8-9C 29.000000 Roll 232.390000 239.58
V0724-0158 SIS'88 80326 Brown Sugar 1kg Bag (Arabic) SBRADK124C - PET12/LLDPE60, 410mm x 1000m x 8-9C 29.000000 Roll 232.390000 239.58
V0724-0158 SIS'88 80326 Brown Sugar 1kg Bag (Arabic) SBRADK124C - PET12/LLDPE60, 410mm x 1000m x 8-9C 10.000000 Roll 234.740000 242
もし私がそれを実現する方法を手伝ってもらえますか?