[Solved] How to item balance


Issue(s) with your query:

  • If you are giving an alias to a table use that alias for each reference. issue: FROM trans AS t1 WHERE (trans.Trans_date <= '2019-08-31'), here trans table is aliased as t1 and you are using again full name with trans.Trans_date.
SELECT 
    i.`Item Desc` AS ItemDesc,
    t.Trans_date AS Trans_date,
    t.B1 AS B1
FROM item AS i
INNER JOIN trans AS t ON i.Item_code = t.Item_code
WHERE t.Trans_date = (SELECT MAX(t1.Trans_date) As trans_date
                     FROM trans t1
                     WHERE t1.Trans_date <= '2019-08-31'
                     AND t1.Item_code = i.Item_code);

0

solved How to item balance