Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6939685
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:39:13+00:00 2026-05-27T12:39:13+00:00

( the last )I would like to sum row with the same user_id (

  • 0

( the last )I would like to sum row with the same user_id ( for the column ponderation, I dont need to have other column , only user_id and ponderation)

enter image description here

My query

SELECT  students_group.user_id,scores.result ,exam.name,exam.ponderation,exam.id, (scores.result * exam.ponderation) / totpond.totalpond as ponderation
from (
select sum(exam.ponderation)  as totalpond from scores
left join exam on exam.id = scores.exam_id
left join teacher_group on teacher_group.id = exam.teacher_group_id
left join groups on  groups.id = teacher_group.group_school_id
left join students_group on students_group.user_id = scores.user_id
where teacher_group.id = 54
group by students_group.user_id

 ) as totpond,scores
left join exam on exam.id = scores.exam_id
left join teacher_group on teacher_group.id = exam.teacher_group_id
left join groups on  groups.id = teacher_group.group_school_id
left join students_group on students_group.user_id = scores.user_id

where teacher_group.id = 54
group by scores.id
order by students_group.user_id

Is it to possible to do that with my query or need to use php ? Can someone help me please ? thx 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T12:39:14+00:00Added an answer on May 27, 2026 at 12:39 pm

    Not necessary you would just need to add the summation of that field in the query:

     SELECT 
           tmp.user_id,
           SUM(tmp.ponderation) as total_ponderation,
           SUM(tmp.aggregate_ponderation) as ponderation
        FROM
        (
        SELECT  students_group.user_id,scores.result ,exam.name,exam.ponderation,exam.id, (scores.result * exam.ponderation) / totpond.totalpond as aggregate_ponderation
        from (
        select sum(exam.ponderation)  as totalpond from scores
        left join exam on exam.id = scores.exam_id
        left join teacher_group on teacher_group.id = exam.teacher_group_id
        left join groups on  groups.id = teacher_group.group_school_id
        left join students_group on students_group.user_id = scores.user_id
        where teacher_group.id = 54
        group by students_group.user_id
    
         ) as totpond,scores
        left join exam on exam.id = scores.exam_id
        left join teacher_group on teacher_group.id = exam.teacher_group_id
        left join groups on  groups.id = teacher_group.group_school_id
        left join students_group on students_group.user_id = scores.user_id
    
        where teacher_group.id = 54
        group by scores.id
        ) tmp
        GROUP BY
          tmp.user_id
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following String First Last <first.last@email.com> I would like to extract first.last
I would like to associate the last installed version of my Mac OS X
I would like to get the last modified date of a remote file by
I would like to get the last date of records modified. Here is a
I would like to read the last 1 megabyte of a MP3 file and
I would like to change the order of names from Last, First to First
Using Python I would like to find the date object for last Wednesday. I
In Nant, I would like to be able to extract the last name of
In the footer of my page, I would like to add something like last
I have two tables, name and address. I would like to list the last_name

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.