Association query between rszl data table and crjsj data table

Source: Internet
Author: User

'search for crjsj data and Personnel Data whose names are 'xx Ms' or whose card number is 99999999 or number is 'sn. '
select crjsj. ID, rszl. BH, crjsj. KH, rszl. XM, crjsj. time8, crjsj. date8, crjsj. mjbh, crjsj. mjkzqbh, crjsj. syqk, crjsj. crjqk
from crjsj right join rszl on crjsj. kh = rszl. kh
where
crjsj. kh = 99999999
or
crjsj. kh = (select KH from rszl where XM = 'xxx 'and DELE = 0)
or
crjsj. kh = (select KH from rszl where bH = 'No.' And DELE = 0)

and date8 between #2005-1-26 # And #2005-7-26 #
; --------------------------------------------------------------------
select. ID, B. BH,. KH, B. XM,. date8,. time8 from crjsj A, rszl B where
. kh = B. kH and
(. kh = 1 or
. kh = (select top 1 KH from rszl where XM = 'xxx 'and DELE = 0) or
. kh = (select top 1 KH from rszl where bH = 'No.' And DELE = 0)
) and
. date8 between #2005-7-26 # And #2005-7-26 #
; --------------------------------------------------------------------

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.