I wish to calulate the item in the warehouse and calculate the free space in the warehouse, then output to a table with column of Inshelf and free and I come up with something like these.
SELECT COUNT(*) as Inshelf, free=10-Inshelf
FROM stock.stockproduct
WHERE StockNum = 1
AND checkOutData is NULL;
Appearly it won't work, are there having any simple solution for this kind of problem?
stock.stockproductWHERE StockNum = 1 AND checkOutData is NULL- you have no checkOutData or StockNum column in the 'schema' you just provided.