Calculated fields within SQL query
问题 Invalid column name ItemA , ItemB , ItemC , ItemD , and ItemE I am migrating this from Progress to SQL and can't reference the calculated fields within the query. After researching the error it appears the only solution is to replace each item with the full expression or create a nested select statement. Neither seem to work in this case. SELECT OrderQty - (ItemE + ShippedQty) AS ItemA, ((CASE WHEN (ItemA > ItemB AND ItemA > 0) THEN (ItemA - ItemB) ELSE 0 END)) AS ItemC, UnitPrice * ItemC AS