php - Finding list of all duplicates based on calculated value -


Using MySQL, I am trying to get a list of teams that are from Bangladesh (win Same number) A list of all the teams in the given list. To calculate the victory for each team, I am using a SUM function while grouping the team.

So far I have created this query:

  SELECT results.DATE, results.team1, SUM (results.win) as WINS, SUM (results.lose ) AS Damage, SUM (results.pt_diff) AS PT_DIFF, event_team.div_sname, event_team.pool_name results, from event_tem, matches WHERE result. Ticket 1 = event_team.team_id and results.sched_id = matches.sched_id and match.match_type = 'pool' and event_team .div_sname = 'C4A' and event_team.pool_name = 'Pool_C4A_1' and event_team.event_id = 25 group results.team1 ORDER Event_team.pool_name, DESC wins, ASC losses, PT_DIFF DESC   

This gives a complete list of query teams and their

  DATE team won 1 Loss PT_DIFF div_sname pool_name ---------- ------ ------ - ----- ------- --------- - ---------- 2014-09-06 54 9 3 28C4A Pool C4,464 2014-09-06 62 6 6 -2C4A Pool Sea 4 Ride 2014-09-06 55 5 7 1 c 4a pool c4 rye 2014-09-06 59 5 7 -7C4A Pool C 4,4 2014-09-06 65 5-7 -20C4A Pool C4 4   

I have these two lines How do I end up with the example above so that I only get 55, 59 and 65 teams, who all win 5? Please note that I can have many connections in my overall results, so all the teams should be seized with any solution to the solution, even if the winnings vary between the groups.

I have made the following efforts, but after reading it I feel that I can not group through a composite task, as a result, event_stom matches WHERE results from matches, results I_SEAM, results_team.pdf .team1 = Event_team.team_id and results.sched_id = matches.sched_id and matches.match_type = 'pool' and event_team.div_sname = 'C4A' and event_team.pool_name = 'Pool_C4A_1' and event_team.event_id = 25 groups winning by any and all Thanks in advance for the answers!

>

Here's a solution: < Pre> selection results. Date, result. TEM 1, results. Eventually, event_team.div_sname, Event_team.pool_name results, event_tem, matches WHERE result.Tem 1 = event_team .team_id and results.sched_id = matches.sched_id and matches.match_type = 'pool' and event_team.div_sname = 'C4A' And event_team.pool_name = 'Pool_C4A_1' and event_team.event_id = 25 and results.win In (results by SELECT results.win results group .win pass COUNT (*)> 1)

This will give you a result set that looks like this:

  + ----- ------- + ------- + ----- + ----------- + ------------ + | DATE | Team 1 | Victory | Div_sname | Pool_name | + ------------ + ------- + ----- + ----------- + ---------- - + | 2014-09-06 | 55 | 5 | C4A | Pool_4 | 2014-09-06 | 59 | 5 | C4A | Pool_4 | 2014-09-06 | 65 | 5 | C4A | Pool_4 + ------------ + ------- + ----- + ----------- + --------- - - +   

This subquery only selects the number of all the wins, where there are more than one number to win the rows.

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -