SQL Server reads the SQL statement in a table updated from another table,

Source: Internet
Author: User
I didn't know how to write it in the past. I have a cursor. Now I know it is easy to use.

Update A Set _ Sum_passtime = B. A1,
_ Sum_work = B. A2,
_ Count_end = B. A3,
_ Sum_tax = B. A4
From # Tg_oo1,
( Select Te_pass_range, Sum (Te_pass_time_hour) A1, Sum (Te_operate_time) A2, Count ( * ) A3, Sum (Te_ratepay_hour) A4   From Tg_entry Where Te_not_in_flag =   0   And Te_endpass_flag =   1 Group   By Te_pass_range) B
Where A. te_pass_range = B. te_pass_range collate chinese_prc_cs_as_ws;
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.