XỬ LÝ SỐ LƯỢNG QUY ĐỔI
Yêu cầu
Thao tác
declare @nghiepvu int = 101
declare @tungay datetime = '01/01/2022'
declare @denngay datetime = '12/31/2022'
update T1 set T1.soluong2 = T1.soluong, T1.dongia2=T1.dongia2
from
(
select *
from dulieuketoan
where nghiepvu=@nghiepvu
and tkno like '15%'
and ngay>=@tungay and ngay<=@denngay
and loaidl=0
and vattu in (26,21,25,22,23,24,173,172,46,44,102,87,171,14,99,96,100,98,122,37,31,35,30,125,126,36,39,29,43,32,33,41,95,92,94,93,45,91,28,40,42,27,38)
)T1
inner join
(
select vattu,dvdo,vdvdo,tyle,congthuc
from dulieudvdo
where tyle<>0 and dvdo<>0 and vattu<>0 and congthuc like '*'
and vattu in (26,21,25,22,23,24,173,172,46,44,102,87,171,14,99,96,100,98,122,37,31,35,30,125,126,36,39,29,43,32,33,41,95,92,94,93,45,91,28,40,42,27,38)
)T2
on T1.vattu=T2.vattu and T1.dvdo = T2.vdvdo and T1.dvdo <> T2.dvdoTRƯỜNG HỢP 2:
Last updated