手机
当前位置:查字典教程网 >编程开发 >ASP教程 >asp 多表联合查询语句
asp 多表联合查询语句
摘要:A表:VENIDVENNAME0001公司10002公司2B表:DOCNOVENIDCDATE2009000100012009-01-012...

A表:

VENID VENNAME
0001 公司1
0002 公司2

B表:
DOCNO VENID CDATE
20090001 0001 2009-01-01
20090002 0002 2009-01-02
20090003 0001 2009-01-03

C表:
DOCNO PLU STORY
20090001 1111 25
20090001 2222 20
20090002 3333 15
20090002 4444 25
20090003 1111 20
20090003 5555 15
(我现在要根据 PLU或者DOCNO或者CDATE来查询得到记录,并如下列出)
单号(DOCNO) 公司名称(VENNAME) 日期(CDATE)
20090001 公司1 2009-01-01
20090002 公司2 2009-01-02
20090003 公司1 2009-01-03

方法一:

select * from A,B where A.VENID=B.VENID and DOCNO in(select DOCNO from C where DOCNO='"&s_dingdan&"' or PLUID='"&s_tiaoma&"')order by RECEDATE desc

方法二:

select * from A,B where A.VENID=B.VENID and DOCNO in(select DOCNO from B where(replace(CONVERT(char(10),CREATEDATE,111),'/','-') between '"&s_riqi&"' and '"&s_riqi2&"')) order by RECEDATE desc"

select * from A,B where A.VENID=B.VENID and DOCNO in(select DOCNO from C where DOCNO='"&s_dingdan&"' or PLUID='"&s_tiaoma&"')order by RECEDATE desc

【asp 多表联合查询语句】相关文章:

遍历目录以及目录下文件的函数

asp下多个域名后缀同时查询的域名查询系统

asp For Next 循环语句语法与实例

域名查询系统用到的类

asp返回404错误状态码程序

vbs(asp)下的Function 语句

asp写入记录

asp 随机读取N条记录sql语句

asp:debug类调试程序

asp 读取 json 列表解决思路

精品推荐
分类导航