BZ字段要求不明确,暂时用BZ代替true,表示你的要求,具体你再修改 select * from ABCD inner join DBCA on ABCD.JZH=DBCA.JZH where time between '2012-1-10' and '2012-2-10' and BZ
我用你那个,增加了一下,好像不行呀? select XM as 姓名,RQ as 日期,YSK as 金额,MZJLID as 机制号,SFZF as 是否作废,''as 发票号,'' as 备注 from dthhis.dbo.T_M_MZ0101 inner join FPLY on dthhis.dbo.T_M_MZ0101.MZJLID=FPGL.dbo.FPLY.MZJLID where SFZGID='44'AND RQ between '2012-1-10' and '2012-2-10' AND SFYYBZ ='' order by MZJLID ASC
这样可以 select *,''as 发票号,'' as 备注 from dthhis.dbo.T_M_MZ0101 inner join FPGL.dbo.FPLY on dthhis.dbo.T_M_MZ0101.MZJLID=FPGL.dbo.FPLY.MZJLID where SFZGID='44'AND RQ between '2012-1-10' and '2012-2-10' AND SFYYBZ ='' order by dthhis.dbo.T_M_MZ0101.MZJLID ASC
dthhis.dbo.T_M_MZ0101 inner join FPLY on dthhis.dbo.T_M_MZ0101.MZJLID=FPGL.dbo.FPLY.MZJLID where SFZGI 改成FPGL.dbo.FPLY
select dthhis.dbo.T_M_MZ0101.XM as 姓名,dthhis.dbo.T_M_MZ0101.RQ as 日期,dthhis.dbo.T_M_MZ0101.YSK as 金额,dthhis.dbo.T_M_MZ0101.MZJLID as 机制号,dthhis.dbo.T_M_MZ0101.SFZF as 是否作废,''as 发票号,'' as 备注 from dthhis.dbo.T_M_MZ0101 inner join FPGL.dbo.FPLY on dthhis.dbo.T_M_MZ0101.MZJLID=FPGL.dbo.FPLY.MZJLID where SFZGID='44'AND RQ between '2012-1-10' and '2012-2-10' AND SFYYBZ ='' order by dthhis.dbo.T_M_MZ0101.MZJLID ASC
SELECT BZ FROM A.dbo.DCBA A WHERE EXISTS(SELECT 1 FROM ABCD WHERE JZH=A.JZH AND RQ >='2012-01-10' AND RQ<='2012-02-10')
select * from ABCD inner join DBCA on ABCD.JZH=DBCA.JZH where time between '2012-1-10' and '2012-2-10'
SELECT * FROM A.ABCD WHERE 时间 between '2012-01-01' and '2012-02-10' AND EXISTS( SELECT 1 FROM B.DCBA WHERE A.ABCD.JZH=B.DCBA.JZH AND BZ... )
select *
from ABCD
inner join DBCA on ABCD.JZH=DBCA.JZH
where time between '2012-1-10' and '2012-2-10'
and BZ
select XM as 姓名,RQ as 日期,YSK as 金额,MZJLID as 机制号,SFZF as 是否作废,''as 发票号,'' as 备注 from dthhis.dbo.T_M_MZ0101 inner join FPLY on dthhis.dbo.T_M_MZ0101.MZJLID=FPGL.dbo.FPLY.MZJLID where SFZGID='44'AND RQ between '2012-1-10' and '2012-2-10'
AND SFYYBZ ='' order by MZJLID ASC
查询分析中提示如下:
服务器: 消息 208,级别 16,状态 1,行 1
对象名 'FPLY' 无效。
这样可以
select *,''as 发票号,'' as 备注 from dthhis.dbo.T_M_MZ0101 inner join FPGL.dbo.FPLY on dthhis.dbo.T_M_MZ0101.MZJLID=FPGL.dbo.FPLY.MZJLID where SFZGID='44'AND RQ between '2012-1-10' and '2012-2-10'
AND SFYYBZ ='' order by dthhis.dbo.T_M_MZ0101.MZJLID ASC
改成FPGL.dbo.FPLY
AND SFYYBZ ='' order by dthhis.dbo.T_M_MZ0101.MZJLID ASC
FROM A.dbo.DCBA A
WHERE EXISTS(SELECT 1 FROM ABCD WHERE JZH=A.JZH AND RQ >='2012-01-10' AND RQ<='2012-02-10')
select *
from ABCD
inner join DBCA on ABCD.JZH=DBCA.JZH
where time between '2012-1-10' and '2012-2-10'
SELECT * FROM A.ABCD
WHERE 时间 between '2012-01-01' and '2012-02-10'
AND EXISTS(
SELECT 1 FROM B.DCBA
WHERE A.ABCD.JZH=B.DCBA.JZH
AND BZ...
)