日期:2014-05-17 浏览次数:20704 次
select a.id, *
from (SELECT id, nd,yd,lb,xhddm,KMDM, je,shbj
FROM TZ_KHZB
where nd=@nd and yd=@yd and xhddm=@xhddm and lb='sj' )a
right join (SELECT ID, KMDM, KMMC, DW, ZKMDM, ERPDM, ZGDW, ZGLD, KHDW, LRR, RKRQ, jldw
FROM SYS_KHZB
WHERE charindex(@KHDW,KHDW)>0)b on a.kmdm = b.kmdm
select a.id, *
from
(
SELECT id, nd,yd,lb,xhddm,KMDM, je,shbj FROM TZ_KHZB
where nd=? and yd=? and xhddm=? and lb='sj'
)a
right join b
(
SELECT ID, KMDM, KMMC, DW, ZKMDM, ERPDM, ZGDW, ZGLD, KHDW, LRR, RKRQ, jldw
FROM SYS_KHZB WHERE charindex(?,KHDW)>0
)b
on a.kmdm = b.kmdm
select a.id,* from
TZ_KHZB a right join SYS_KHZB b on a.kmdm = b.kmdm
where a.nd=? and a.yd=? and a.xhddm=? and a.lb='sj' and charindex(?,b.KHDW)>0
declare @sql varchar(max)
set @sql = '
select * from
(
SELECT id, nd,yd,lb,xhddm,KMDM, je,shbj FROM TZ_KHZB
where nd='+?+' and yd='+?+' and xhddm=?&nbs