ASP multiple table Joint query statement

Source: Internet
Author: User

Table A:
Venid Venname
0001 Company 1
0002 Company 2

Table B:
Docno Venid CDATE
20090001 0001 2009-01-01
20090002 0002 2009-01-02
20090003 0001 2009-01-03

C Table:
Docno PLU STORY
20090001 1111 25
20090001 2222 20
20090002 3333 15
20090002 4444 25
20090003 1111 20
20090003 5555 15
(I'm now going to query for records based on PLU or Docno or CDate, as listed below)
Dan (DOCNO) company name (venname) Date (CDATE)
20090001 Company 1 2009-01-01
20090002 Company 2 2009-01-02
20090003 Company 1 2009-01-03

Method One:

SELECT * from A,b where A.venid=b.venid and Docno into (select Docno from C where docno= ' "&s_dingdan&" ' or pluid= ') &A mp;s_tiaoma& "') Order by recedate Desc

Method Two:

SELECT * from A,b where A.venid=b.venid and Docno in (select Docno from B where (replace) (CONVERT (char), createdate,111), '/ ', '-') between ' "&s_riqi&" and "&s_riqi2&") Order BY recedate Desc "

SELECT * from A,b where A.venid=b.venid and Docno into (select Docno from C where docno= ' "&s_dingdan&" ' or pluid= ') &A mp;s_tiaoma& "') Order by recedate Desc

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.