我有以下SQL查詢SQL在同一個SQL查詢生成從一個新列的新列
SELECT
i.catalogid, i.itemname,
CASE WHEN o.oshippeddate is not null
AND o.oshippeddate between @Date1 AND @Date2
THEN ISNULL(i.F2,0)
ELSE 0 END +
CASE WHEN o.oshippeddate2 is not null
AND o.oshippeddate2 between @Date1 AND @Date2
THEN ISNULL(i.F3,0)
ELSE 0 END +
CASE WHEN o.oshippeddate3 is not null
AND o.oshippeddate3 between @Date1 AND @Date2
THEN ISNULL(i.F4,0)
ELSE 0 END AS amount,
amount*i.ekprice EK,
amount * (i.unitprice
- ((i.unitprice/((o.otax/100)+1))
- o.odiscount-o.oshipcost-o.coupondiscount) VK
FROM orders o
INNER JOIN oitems i
ON i.orderid = o.orderid
如果你看一下,我要選擇他們是從柱量生成的最後兩列其中是由它自我生成一個新的列使用選擇案例語句,我是新來的SQL,我想知道如何我可以得到這樣的事情工作,所以基本上它說invalid column name amount