Untitled
unknown
sqlserver
4 years ago
653 B
4
Indexable
use ex5 -- 1. Viết procedure sp_Cau1 cập nhật thông tin TONGGT trong bảng hóa đơn theo dữ liệu thực tế của bảng CHITIETHOADON create alter proc sp_Cau1 as begin update HOADON set HoaDon.TONGTG = e.tonggg -- select h.MAHD, e.tonggg from hoadon h join ( select mahd, sum(SL*GIABAN) tonggg from CHITIETHOADON group by mahd ) e on h.mahd = e.MAHD end begin tran sp_Cau1 select * from HOADON select * from CHITIETHOADON rollback tran select h.MAHD, e.tonggb from hoadon h join ( select mahd, sum(SL*GIABAN) tonggb from CHITIETHOADON group by mahd ) e on h.mahd = e.MAHD
Editor is loading...