|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Friday, February 26, 2010 4:44 AM
Points: 5,
Visits: 31
|
|
SELECT Vw_Final_Inventory_Report_1.*, (select sum(Dqtyin) - sum(Dqtyout) from Tb_Item_Cost_Ledger where itemid = Vw_Final_Inventory_Report_1.coa_id and VDate < '2009/01/01') as ClosingBalance
FROM Vw_Final_Inventory_Report_1
this query works fine but when i try to input where clause it gives error as following
SELECT Vw_Final_Inventory_Report_1.*, (select sum(Dqtyin) - sum(Dqtyout) from Tb_Item_Cost_Ledger where itemid = Vw_Final_Inventory_Report_1.coa_id and VDate < '2009/01/01') as ClosingBalance
FROM Vw_Final_Inventory_Report_1
where (ClosingBalance = 0 )
|
|
|
|
|
SSC-Addicted
      
Group: General Forum Members
Last Login: Wednesday, March 17, 2010 4:17 AM
Points: 473,
Visits: 836
|
|
You can not use derived column names in the WHERE clause.
Try following query:
SELECT Vw_Final_Inventory_Report_1.* ,(sum(Dqtyin) - sum(Dqtyout)) AS ClosingBalance FROM Vw_Final_Inventory_Report_1 vw INNER JOIN Tb_Item_Cost_Ledger tb ON tb.itemid = vw.Vw_Final_Inventory_Report_1.coa_id WHERE VDate < '2009/01/01' AND (sum(Dqtyin) - sum(Dqtyout)) = 0
-Vikas Bindra
|
|
|
|