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

  • Home
  • SEARCH
  • 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 9122347
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T06:04:54+00:00 2026-06-17T06:04:54+00:00

Table: Name | Value | Prize Race1 32 5 Race1 22 5 Race1 30

  • 0

Table:

Name | Value | Prize
Race1   32      5
Race1   22      5
Race1   30      5
Race2   11      5
Race2   12      5
Race2   31      5

What I want to query, When I define a Value 20+, The UNIQUE races (Race1, Race2) will be selected to my result, based on whose Value is higher. And prize should be summed.

So when I do metaquery : select sum(Prize) biggestValueUniqueRaces where value > -20
I get:

Query returns :

Prize
  10

Where it took into consideration these 2 rows :

Name | Value | Prize
Race1   32      5
Race2   31      5
  • 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-17T06:04:55+00:00Added an answer on June 17, 2026 at 6:04 am

    Edit re comment

    SELECT Sum(Races.Prize) As Total
    FROM Races INNER JOIN (SELECT r.[Name], Max(r.[Value]) AS MaxOfValue
    FROM Races r WHERE [Value]>20
    GROUP BY r.[Name])  AS q 
    ON (Races.Value = q.MaxOfValue) AND (Races.Name = q.Name);
    

    Or

    SELECT SUM(races.prize) AS SP
    FROM   races
    WHERE  races.id IN (
        SELECT id
        FROM   races r
        WHERE  r.name = races.name
        AND VALUE = (
           SELECT Max(VALUE)
           FROM   races s
           WHERE  s.[name] = r.name
           AND VALUE > 20 ))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Below I have table - Company id name value year 1 IBM 10 2011
I have a MySQL table structured somewhat like this: type name value ===================== 1
I have an entity mapped as following: @Entity @Table(name = Groups) @IdClass(value = GroupId.class)
I have a table that looks something like this: Name Year Value A 2000
Wordpress, for example, has a table with name => value rows for storing application-wide
This the name of my table Result_Simul This is the value Pk FkIdResult FkIdSimul
I have a stupid question, I have this table : id_product name value 1
Problem: I have a html table with 4 columns (Name, Price, Quantity, Value). The
I want to know how to get the value of the selected rawquery Cursor
I am trying to make an HTML table like this: Name Price Original Value

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.