I came up with the below query to display the stock value at a given date in the past.The total value is correct as per the Inventory Audit report. However, it displays the total value for the two warehouses that we have, yet I want it to display the value separately per warehouse. My chart of accounts has only one (general) account defined.
SELECT T0.[Debit]-T0.[Credit] FROM [dbo].[JDT1] T0 WHERE T0.[Account] ='XXXX' AND T0.[RefDate] <='%0'
Anyone with an idea about how I can I can display the values separately? Thank you.