我想運行一個查詢,在那裏我可以用where子句加入Alias和凡在SQL
在一個別名例如:
Select V.Fees - Coalesce(V.Payment,0) - Coalesce (V.Adjustment,0) AS Balance
[
the inner join query for the tables
]
Where A.Order not Null and Balance = 0
Order by Name
但像往常一樣是不能夠識別欠平衡哪裏?
我們該如何解決這個問題?
使用子查詢,或重複表達或在MySQL中使用having子句。 – 2014-09-26 15:15:42
或者只是在其中重複該操作:'Where A.Order not Null and V.Fees- Coalesce(V.Payment,0) - Coalesce(V.Adjustment,0)= 0' – 2014-09-26 15:17:16
有可能是最好的選擇: http://stackoverflow.com/questions/2905292/where-vs-having – DarkMukke 2014-09-26 15:17:18