Viết bởi: Hoàng Trọng Nghĩa 29-02-24, 04:29 PM Chuyên mục: Query - Bài trả lời (9) |
SELECT ToNhom, LenhSanXuat, NgayCap, DonHang, NgayDH, NgayGH, TenKH, MaKH, MAsP, MAsPKhach, MaQuai, MaDe, MaMatTay, MauSac, ChatLieu, HieuIn, NhomSizeQuai, ChiTietQuai, NhomSizeDe, ChiTietDe, TimeRowDH, NgayNhan, Sum(PCSize38) AS PC38, Sum(PCSize39) AS PC39, Sum(PCSize40) AS PC40, Sum(PCSize41) AS PC41, Sum(PCSize42) AS PC42, Sum(PCSize43) AS PC43, Sum(PCSize44) AS PC44, Sum(PCSize45) AS PC45, Sum(PCSize46) AS PC46, Sum(PCTong) AS TongPC, Sum(SXSize38) AS SX38, Sum(SXSize39) AS SX39, Sum(SXSize40) AS SX40, Sum(SXSize41) AS SX41, Sum(SXSize42) AS SX42, Sum(SXSize43) AS SX43, Sum(SXSize44) AS SX44, Sum(SXSize45) AS SX45, Sum(SXSize46) AS SX46, Sum(SXTong) AS TongSX
FROM (SELECT
fldToNhom As ToNhom,
fldLenhSX As LenhSanXuat,
fldNgayCap As NgayCap,
fldDonHang As DonHang,
fldNgayDH As NgayDH,
fldNgayGH As NgayGH,
fldTenKH As TenKH,
fldMaKH As MaKH,
fldMAsP As MAsP,
fldMAsPKhach As MAsPKhach,
fldMaQuai As MaQuai,
fldMaDe As MaDe,
fldMaMatTay As MaMatTay,
fldMauSac As MauSac,
fldChatLieu As ChatLieu,
fldHieuIn As HieuIn,
fldNhomSizeQuai As NhomSizeQuai,
fldChiTietQuai As ChiTietQuai,
fldNhomSizeDe As NhomSizeDe,
fldChiTietDe As ChiTietDe,
fldTimeRowDH As TimeRowDH,
IIF(fldNgayNhan>0,'X','') As NgayNhan,
fldSize38 As PCSize38, 0 As SXSize38,
fldSize39 As PCSize39, 0 As SXSize39,
fldSize40 As PCSize40, 0 As SXSize40,
fldSize41 As PCSize41, 0 As SXSize41,
fldSize42 As PCSize42, 0 As SXSize42,
fldSize43 As PCSize43, 0 As SXSize43,
fldSize44 As PCSize44, 0 As SXSize44,
fldSize45 As PCSize45, 0 As SXSize45,
fldSize46 As PCSize46, 0 As SXSize46,
fldTongSL As PCTong, 0 As SXTong
FROM [tblPhanCong]
UNION ALL SELECT
fldToNhom As ToNhom,
fldLenhSX As LenhSanXuat,
fldNgayCap As NgayCap,
fldDonHang As DonHang,
fldNgayDH As NgayDH,
fldNgayGH As NgayGH,
fldTenKH As TenKH,
fldMaKH As MaKH,
fldMAsP As MAsP,
fldMAsPKhach As MAsPKhach,
fldMaQuai As MaQuai,
fldMaDe As MaDe,
fldMaMatTay As MaMatTay,
fldMauSac As MauSac,
fldChatLieu As ChatLieu,
fldHieuIn As HieuIn,
fldNhomSizeQuai As NhomSizeQuai,
fldChiTietQuai As ChiTietQuai,
fldNhomSizeDe As NhomSizeDe,
fldChiTietDe As ChiTietDe,
fldTimeRowDH As TimeRowDH,
IIF(fldNgayNhan>0,'X','') As NgayNhan,
0 As PCSize38, fldSize38 As SXSize38,
0 As PCSize39, fldSize39 As SXSize39,
0 As PCSize40, fldSize40 As SXSize40,
0 As PCSize41, fldSize41 As SXSize41,
0 As PCSize42, fldSize42 As SXSize42,
0 As PCSize43, fldSize43 As SXSize43,
0 As PCSize44, fldSize44 As SXSize44,
0 As PCSize45, fldSize45 As SXSize45,
0 As PCSize46, fldSize46 As SXSize46,
0 As PCTong, fldTongSL As SXTong
FROM [tblSanXuat]
WHERE fldPhanLoai<>'BTP') AS [%$##@_AliAs]
GROUP BY ToNhom, LenhSanXuat, NgayCap, DonHang, NgayDH, NgayGH, TenKH, MaKH, MAsP, MAsPKhach, MaQuai, MaDe, MaMatTay, MauSac, ChatLieu, HieuIn, NhomSizeQuai, ChiTietQuai, NhomSizeDe, ChiTietDe, TimeRowDH, NgayNhan;
Viết bởi: btamsgn 19-02-24, 09:37 PM Chuyên mục: Forms - Bài trả lời (11) |
Viết bởi: binhhoajp1052 04-01-24, 10:21 AM Chuyên mục: Macro - Bài trả lời (13) |
Viết bởi: Noname 31-12-23, 09:40 AM Chuyên mục: Thông báo - Không có hồi đáp |
Viết bởi: binhhoajp1052 28-12-23, 07:29 PM Chuyên mục: Macro - Bài trả lời (4) |
Diễn đàn Thống kê |
» Thành viên: 4,843 » Thành viên mới nhất: Dvpkcz » Các chủ đề diễn đàn: 9,866 » Các bài viết diễn: 48,546 Thống kê đầy đủ |