Code
use prtvu
go
declare @@nj char(4)
declare @@jj char(2)
declare @@mm int
declare @@cur datetime
set @@cur=getdate()
set @@nj=cast(datepart(year,@@cur) as char(4))
set @@mm=cast(datepart(month,@@cur) as int)
set @@jj=
case
when @@mm>8 then '09'
else '03'
end
select xh,xm,bmc,dwmc,jjmc from zxsdab
where xh not in(
select distinct xh from xsxkjgb
where nd=@@nj and xqdm=@@jj
) and xjztdm='1'
order by dwmc,bmc,xh,xm
use prtvu
go
declare @@nj char(4)
declare @@jj char(2)
declare @@mm int
declare @@cur datetime
set @@cur=getdate()
set @@nj=cast(datepart(year,@@cur) as char(4))
set @@mm=cast(datepart(month,@@cur) as int)
set @@jj=
case
when @@mm>8 then '09'
else '03'
end
select xh,xm,bmc,dwmc,jjmc from zxsdab
where xh not in(
select distinct xh from xsxkjgb
where nd=@@nj and xqdm=@@jj
) and xjztdm='1'
order by dwmc,bmc,xh,xm