I have two tables: one holding products and one holding related inventory moves.
Product table:
Seq | Name | Barcode
Move table:
Seq | ProductFK | Direction | Date
Each product can have multiple IN and/or OUT move records.
How can I get a list of all product that are in stock at any given date?
I tried the following but that does not work if there are more than one IN and OUT moves:
SELECT DISTINCT Product.* , Move.* FROM Product LEFT JOIN Move ON Product.Seq=Move.StockFK where not exists ( select * from Move where Product.Seq=Move.StockFK and Direction = "OUT")
Can anyone help me on this please. I am using MySQL 5.1.