A表
VENID VENNAME
公司
公司
B表
DOCNO VENID CDATE
C表
DOCNO PLU STORY
(我現在要根據 PLU或者DOCNO或者CDATE來查詢得到記錄並如下列出)
單號(DOCNO) 公司名稱(VENNAME) 日期(CDATE)
公司
公司
公司
方法一
select * from AB where AVENID=BVENID and DOCNO in(select DOCNO from C where DOCNO="&s_dingdan&" or PLUID="&s_tiaoma&")order by RECEDATE desc
方法二
select * from AB where AVENID=BVENID and DOCNO in(select DOCNO from B where(replace(CONVERT(char()CREATEDATE)/) between "&s_riqi&" and "&s_riqi&")) order by RECEDATE desc"
select * from AB where AVENID=BVENID and DOCNO in(select DOCNO from C where DOCNO="&s_dingdan&" or PLUID="&s_tiaoma&")order by RECEDATE desc
From:http://tw.wingwit.com/Article/program/net/201311/14333.html