huy11tct2 > 01-05-13, 09:58 PM
quan_pc > 01-05-13, 11:29 PM
Thanh Phương > 06-05-13, 10:01 AM
SELECT Phieu_Nhap_Chi_Tiet.MaXe, Sum(NZ([SoLuong])) AS TongNhap FROM Phieu_Nhap_Chi_Tiet GROUP BY Phieu_Nhap_Chi_Tiet.MaXe;
SELECT Hoa_Don_Ban_Xe_Chi_Tiet.MaXe, Sum(NZ([SoLuong])) AS TongXuat FROM Hoa_Don_Ban_Xe_Chi_Tiet GROUP BY Hoa_Don_Ban_Xe_Chi_Tiet.MaXe;
SELECT Xe.MaXe, Xe.TenXe, Xe.SoLuong AS TonDau, IIf([TongNhap]>0,[TongNhap],0) AS DaNhap, IIf([TongXuat]>0,[TongXuat],0) AS DaXuat, [TonDau]+[DaNhap]-[DaXuat] AS TonCuoi FROM (qryTongNhap RIGHT JOIN Xe ON qryTongNhap.MaXe = Xe.MaXe) LEFT JOIN qryTongXuat ON Xe.MaXe = qryTongXuat.MaXe;
huy11tct2 > 06-05-13, 06:48 PM