Tsql supports multi-column in Multi-column matching in Oracle.

Source: Internet
Author: User
Expected results: (I got a one-to-one relationship and compared it to another table) Select * From empoylee where (address1, address2) in (select address1, address2from empoyleeadresseswhere Country = 'Canada ') the preceding method cannot be used. You can also select * from (select (zcbm |', '| fwbm), which is slow) as T from t_fwzc) TT where T not in (select (zcbm | ',' | fwbm) as C from t_zc_fc_gx) solution 1: Use exists to determine select. * From empoylee awhere exists (select 'A' from empoyleeadresses B where B. count Ry = 'Canada 'and. address1 = B. address1 and. address2 = B. address2) solution 2: Use the inner join link to select * fromempoyleeinner join empoyleeadressesonempoylee. address1 = empoyleeadresses. address1andempoylee. address2 = empoyleeadresses. address2whereempoyleeadresses. country = 'Canada ') Select * fromempoylee eminner join empoyleeadresses emaonem. address1 = EMA. address1andem. address2 = EMA. address2andema. country = 'Canada 'Solution Solution 3: Associate the table with select. * From empoylee A, (select address1, address2 from empoyleeadresses where country = 'Canada ') bwherea. address1 = B. address1anda. address2 = B. address2 subjective perception solution 1 is faster. Objectively, you have not used "show Execution Plan" in the query analyzer to check which method is more efficient. for a delete statement, the statement is written as follows: delete from empoylee where exists (select 'A' from empoyleeadresses B where B. country = 'Canada 'and empoylee. address1 = B. address1 and empoylee. address2 = B. address2) Note delete fr Aliases cannot be used for tables after om ~

 

Related Article

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.