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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T18:41:06+00:00 2026-06-15T18:41:06+00:00

SELECT * FROM ( SELECT a.*, a.id AS id_player, (SELECT COUNT(id) FROM `vd7qw_footsal_goals` WHERE

  • 0
 SELECT *
 FROM ( SELECT a.*, a.id AS id_player, 
        (SELECT COUNT(id)
         FROM `vd7qw_footsal_goals`
         WHERE a.id = id_player
         AND id_group IN (SELECT id_group
                          from `vd7qw_footsal_groupofleague`
                          WHERE id_league = 2)
         ) AS goals, 
         team.team_name
         FROM `vd7qw_footsal_players` AS a
         LEFT JOIN vd7qw_footsal_teams AS team
              ON team.id = a.id_team
         LEFT JOIN vd7qw_footsal_teamofgroup AS tog
              ON tog.id_team = team.id
         LEFT JOIN vd7qw_footsal_groups AS g
              ON g.id = tog.id_group
         WHERE (a.state IN (1))
        ) AS h
 WHERE goals > 0
 ORDER BY goals DESC

This is my query when I have 2 or more groups in 1 league and player score a goal in each group, query returns the correct number of goals but duplicates player for example:

John Doe got 3 goals in group 1

and

John Doe got 4 goals in group 2

Query returns:

John Doe got 7 goals

where is my mistake?

  • 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-15T18:41:07+00:00Added an answer on June 15, 2026 at 6:41 pm

    Try GROUP BY

    SELECT *
     FROM ( SELECT a.*, a.id AS id_player, (SELECT COUNT(id)
     FROM `vd7qw_footsal_goals`
     WHERE a.id = id_player
     AND id_group IN (SELECT id_group
     from `vd7qw_footsal_groupofleague`
     WHERE id_league = 2)) AS goals, team.team_name
     FROM `vd7qw_footsal_players` AS a
     LEFT JOIN vd7qw_footsal_teams AS team
     ON team.id = a.id_team
     LEFT JOIN vd7qw_footsal_teamofgroup AS tog
     ON tog.id_team = team.id
     LEFT JOIN vd7qw_footsal_groups AS g
     ON g.id = tog.id_group
     WHERE (a.state IN (1))) AS h
     WHERE goals > 0
    GROUP BY id_group
     ORDER BY goals DESC
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have this Query : SELECT a.*, a.id AS id_player, (SELECT COUNT(id) FROM `vd7qw_footsal_goals`
I have a simple query: Select Count(p.Group_ID) From Player_Source P Inner Join Feature_Group_Xref X
Hi I have the following query : Player.select(Players.*, (SELECT COUNT(*) FROM Results WHERE Results.player_id
I have this query: Select Sysdate,Sum(Count(P.Init_Dtime)) From Player p,player_source ps Where Ps.Group_Id In (44,9,42,15,23,73,45,33,69,63,7,49,96,81,28,57,98,74,92,38)
I have a query that spits out a result: Select Sum(Count(P.Create_Dtime)), From Player P
I have this query: Select Trunc(Create_Dtime),Count(Trunc(Create_Dtime)) as Day_0 From Player Group By Trunc(Create_Dtime) Order
select retention , Sum(count(retention)) over(order by retention desc) as Num_Users_Retained from (select player_id ,
I have two querys: Select trunc(create_dtime) as Day, Count(Player_Id) as New_Users From Player Where
I have this simple query: Select To_Date('2012-sep-03','yyyy-mon-dd')as Date_Of_Concern, Count(Player_Id) as Retained From Player Where
I have a query like this: SELECT PlayerID, COUNT(PlayerID) AS MatchesPlayed, Name, Role, Team,

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.