<?
/* SELECT StockMonthly.ItemID, StockMonthly.Name, StockMonthly.Type, StockMonthly.Date, StockMonthly.[m^2], StockMonthly.[m^3], StockMonthly.Stack, StockMonthly.[GR/GI], IIf(IsNull([IN]),0,[IN]) AS Received, IIf(IsNull([OUT]),0,[OUT]) AS Shipment, IIf(IsNull([TotalBefore]),0,[TotalBefore]) AS [Stock Before],
IIf(min([Date]) ,[TotalBefore]+[IN], [Total Amount](วันก่อนหน้า) +[IN]-[OUT](วันก่อนหน้า)) AS Total Amount
FROM StockMonthly LEFT JOIN StockMonth_Before_Query ON StockMonthly.ItemID = StockMonth_Before_Query.ItemID
ORDER BY StockMonthly.Date AND StockMonthly.ItemID DESC;
*/
?>
Tag : Ms Access, Ms SQL Server 2008, Excel (Excel.Application), VB.NET