Query for Expire Items ?Hi All
I'm developing a program for my grocery.
I want to get expire items.
I'm using the following tables
SID Name CSB
28 aaaaa 18
id SID EXPDATE PRICE QTY
73 28 2017-07-02 45.00 10
95 28 2017-07-14 45.00 10
before my second purchase I sold 02 items.
then i did my second purchase and now I have total 18 items.
I used the following query
SELECT S.SID, S.Name, S.CSB, P.EXPDATE
FROM tblPURCHASE AS P INNER JOIN tblSTOCKAS S ON P.SID = S.SID
WHERE P.EXPDATE between '2017-07-01' and '2017-07-10'
and it returns
SID Name CSB EXPDATE
28 aaaaa 18 2017-07-10
BUT CORRCET ANSWER IS CSB=8 NOT CSB=18
Please help me to fix this problem