手机
当前位置:查字典教程网 >编程开发 >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写入记录

XSS测试语句大全

asp实现表格3列5行

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

域名查询系统用到的类

asp 常用函数用法

asp读取xml文件

vbs(asp)下的Function 语句

asp返回404错误状态码程序

asp 简单ubb代码转换程序

精品推荐
分类导航