tried to select table with alias and simple math, tried to call the alias to use function in where query, found error
here's the code
SUM(q.deliveryqty) AS TotalQtySpb,
p.poqty-SUM(q.deliveryqty) AS otspo
otspo != ''
tb_rls q ON p.PONumber = q.PONumber AND p.description = q.description
It's not possible to reference an expression by the alias assigned in the
SELECT list in the
WHERE clause of the same SELECT.
But the alias can be referenced in a
. remove the
WHERE clause (which is in the wrong place anyway)
. at the end of the statement following the
GROUP BY clause, add
HAVING otspo != ''