I can not find the right result as a result, I want to set up the cost column SM but fail. Total fee cost should be the sum of, but when I made the group by 6000+, did I make a mistake?
Select PTTeille, SUM (COST), as part of Total_Fees, join the CKost P Inner Course from the programs c.programme_id = c.programme_idInner class_sual Turn on Seas in c.course_id = Cs.course_id and c.semester = 4 Join class_enrollments CE on cs.schedule_id = ce.schedule_id Insider students include s.student_id = s.student_id and s.student_id = '13WAR1001' group By p.title, c. Cost; TITLE TOTAL_FEES COST ----------------------------------------------- ---------------------------------- ------------------ ---- Undergraduate of Information Technology (Hons) in Internet Technology 1728 576 Banker of Information Technology (Hons) in Internet Technology 1353 451 Banking of Information Technology (Hons) in Internet Technology 1184 592 Bachelor in Information Technology (Hons) in Internet Technology 1800 600 Title COURSE_ID TOTAL_FEES --------------------------------------------- -------------------------------------------------- ----- ---------- ---------- B Clr of Information Technology (Hons) Internet Technology 14 1728 Bachelor Bachelor of Internet technology in Technology (Hons) 15 1353 Internet Information Technology Technology (Hons) 13 1800 Bachelor of Information Technology (Hons) Internet Technology 12 1184 SQL & gt; Selection amount from the courses (cost) where course_id = 14 or course_id = 15 or course_id = 13 or course_id = 12; After deletion by SUM (COST) ---------- 2219
//// c.cost and group c.cost
TITLE TOTAL_FEES --------------------------------------------- - ------------------------------------------------- ------ ---------- Bachelor of Information Technology (Hons) in Internet Technology 6065
You should not include the selection or group cost
, as you do not want to calculate the sum of the groups based on title and cost, instead :
SELECT p.title, SUM (cc) Ost) Include P INNER courses from the AS Total_Fees program at c.programme_id = c.programme_id INNER class_schedules cs ON C cosse_id = Cs.course_id and c.semester = 4 Join INNER class_enrollments CE on cs.schedule_id = ce .schedule_id Join INNER students at CESTUDUT_ID = s.student_id and s.student_id = '13WAR1001' group by p.title;
Comments
Post a Comment