SQL has been severely affected in recent days

Source: Internet
Author: User

Check the number of complaints for one problem,

Question Answer: Multiple answer complaints

I wrote

(Select sum (sumxx) as XX, questionid from (
Select t1.answerid, t2.sumxx, t1.questionid from (select answerid, questionid from tb_answer as T0) as T1 left join
(Select answerid, count (answerid) as sumxx from tb_complaint where isdelete! = 1 group by answerid) as T2
On t1.answerid = t2.answerid) as T3 group by questionid) as XT

Written by a colleague

Select. questionid, count (. questionid) from tb_question a inner join tb_answer B on. questionid = B. questionid inner join tb_complaint C on C. answerid = B. answerid group by. questionid

 

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.