Query the relevant data for a specific time in several schools

Source: Internet
Author: User

Today I wrote a SQL statement, using the table joins and temporary tables, the syntax for their own reference later.

SELECTUs.school_name School Name, CONCAT (Ug.grade_name, uc.classes_name) grade class, UU.user_idUser ID, uu.user_real_name student name, ta.assignment_id job serial number, ta.assignment_write_time composition writing time (in seconds), Ta.assignment_ Word_count words, ta.assignment_submit_count composition submission times, ta.assignment_start_date assignment start time, Ta.assignment_end_date job deadline , Ta.assignment_submit_date job submitted teacher time, Ta.assignment_mark1 job scoring the first item (content), TA.ASSIGNMENT_MARK2 job scoring second item (language), TA. Assignment_mark3 the third item of job scoring (literary or structural), ta.assignment_mark_sum three scores, teacher_list.user_real_name teacher's name fromt_assignment ta Left JOINU_user UU onTa.user_id =Uu.user_id Left JOINU_classes_user UCU onUu.user_id =Ucu.user_id Left JOINU_classes UC onucu.classes_id=uc.classes_id Left JOINU_school_grade USG onuc.school_grade_id=usg.school_grade_id Left JOINU_grade UG onusg.grade_id=ug.grade_id Left JOINU_school US onusg.school_id=us.school_id Left JOINU_user_role Uur onUu.user_id =Uur.user_id Left JOINU_role ur onuur.role_id=ur.role_id Left JOIN (    SELECTucu.classes_id, Uu.user_real_name fromU_user UU Left JOINU_user_role Uur onUu.user_id =Uur.user_id     Left JOINU_role ur onuur.role_id=ur.role_id Left JOINU_classes_user UCU onUu.user_id =Ucu.user_id    WHEREuur.role_id= ' the') Teacher_list onteacher_list.classes_id=ucu.classes_idWHEREta.assignment_start_date> '2014-09-01 00:00:00' andTa.assignment_start_date< '2015-01-31' anduur.role_id= ' -' andus.school_idinch('7','8','5','2');

Query the relevant data for a specific time in several schools

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.