Operations between two tables in a T-SQL database

Source: Internet
Author: User
--Modify the data in the table according to another table
Update ADMIN_FCOUTDT set Olastid=t.contractid from (select Crm_contract.contracttopic,crm_contract.contractid from Admin_fcoutdtleft join Crm_contract on admin_fcoutdt.contractname=crm_contract.contracttopic) Twhere Admin_ fcoutdt.contractname=t.contracttopic--query Another table insert into ADMIN_FCOUTDT (protype,number) Select ' Test ', num from crm_ Contract--deletes data from a table based on another table delete from Admin_fcoutdt where LastID in (select ID from admin_fcout where prod like '%ef% ')--two table fit and query (a query between two tables lists only this one.) A separate chapter will be introduced) Select Fnumber, fname from Admin_fcoutdt where State=1union allselect nub as Fnumber,fname  

Operations between two tables in a T-SQL database

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.