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 8713797
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T05:25:31+00:00 2026-06-13T05:25:31+00:00

Edit: Deleted my old message cause it was confusing. And i can’t answer my

  • 0

Edit: Deleted my old message cause it was confusing. And i can’t answer my own question for now.

Found, problem come from GROUP BY.

After some researches, i found that we can’t use GROUP BY for group a column inside grouped rows.

So this work as expected :

SELECT candidats.*
      , AVG(test_results.rate_good_answer) AS toto
  FROM "candidats" 
LEFT JOIN "sessiontests"
  ON "sessiontests"."candidat_id" = "candidats"."id"  
LEFT JOIN "test_results"
  ON "test_results"."sessiontest_id" = "sessiontests"."id" 
LEFT JOIN "questionnaires"
  ON "questionnaires"."id" = "test_results"."questionnaire_id"  
WHERE (sessiontests.terminate = 't' )
  AND ("questionnaires"."category" LIKE '%java%' ) 
GROUP BY candidats.id 
ORDER BY toto

But this will grouped only my column in test_results :

SELECT candidats.*, 
  FROM "candidats" 
LEFT JOIN "sessiontests"
  ON "sessiontests"."candidat_id" = "candidats"."id"  
LEFT JOIN "test_results"
  ON "test_results"."sessiontest_id" = "sessiontests"."id" 
LEFT JOIN "questionnaires"
  ON "questionnaires"."id" = "test_results"."questionnaire_id"  
WHERE (sessiontests.terminate = 't' )
 AND ("questionnaires"."category" LIKE '%java%' ) 
GROUP BY candidats.id, test_results.rate_good_answer 
ORDER BY AVG(test_results.rate_good_answer)

Edit 3 :

My problem was the second query was returning each different test_results row for my candidats, whereas i expected it to return me one line per candidat.

First query, is the answer, and it works nice.

  • 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-06-13T05:25:33+00:00Added an answer on June 13, 2026 at 5:25 am

    SELECT candidats.*
    , AVG(test_results.rate_good_answer) AS toto
    FROM “candidats”
    LEFT JOIN “sessiontests”
    ON “sessiontests”.”candidat_id” = “candidats”.”id”
    LEFT JOIN “test_results”
    ON “test_results”.”sessiontest_id” = “sessiontests”.”id”
    LEFT JOIN “questionnaires”
    ON “questionnaires”.”id” = “test_results”.”questionnaire_id”
    WHERE (sessiontests.terminate = ‘t’ )
    AND (“questionnaires”.”category” LIKE ‘%java%’ )
    GROUP BY candidats.id
    ORDER BY toto

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've found a few related questions, like Python vs. Perl (now deleted) and Is
I accidentally managed to lose the old version of our data model, and now
I'm stack on a strange situation. And I can't resolve it logically. The problem:
I am using C#.net I want to add custom edit/delete buttons to my GridView1
To allow users and site admins to view/add/edit/delete data in my application I decided
I'm following this awful textbook, going through the basics of create/edit/delete records. The delete
Using tastypie, how do I only authorize authors of objects the ability to edit/delete
I want to be able to edit and delete resources myself, but not allow
Am trying to add a link besides the Edit | Delete links in wordpress
We have an application that allows users to add/edit/replace/delete content (text, images, swfs, mp3s,

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.