Two updated SQL statements

Source: Internet
Author: User
Code
Update tb_plan_batch
Set fact_examinee_count = (select sum (1)
From tb_examinee_exam t
Where T. del_flag = 0 and T. batch_id = t1.batch _ id
)
From tb_plan_batch T1
Where t1.plan _ id = @ planid

-- Used to update the scores of the correct answers
Update tb_examinee_paper
Set valid_score = t1.question _ score
From tb_examinee_paper T1
Left join tb_question_info T2
On t1.question _ NO = t2.question _ No
Left join tb_examinee_exam T3
On t1.examinee _ exam_id = t3.examinee _ exam_id
Where t3.batch _ id = @ batchid and t1.examinee _ Answer = t2.standard _ Answer
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.