are we supposed to make a guess as to what language you are using?
w3schools.com is always a good start
PHP: Hypertext Preprocessor and
theres always
Asp.Net
thers perl, cgi, and god knows how many other languages out there to extract data from MySQL... theres
Vb.NET, C, C++, C#, Java, theres C++ builder.......
what you are asking is pretty trivial
you need toknow the current stock (do a SQL query to find that)
then sum the current orders/sales (do)
then pull off the last deliveries (order by delivery date descending untill you have retireved the current sotck.
if your stock movements were in the same table its even easier you issue a single SQL statement to get the current stock.
I have yet to come accross what you are lookig for in a live app.
however I sauspect that you coudl do what you want within a sub query, but it should be a pig performance wise. Although if Rudy R937 says do it in your application language then I guess thats what you should do......