MySQL How to calculate Partnership Scores from Cricket ball by ball database [Solved]Speeding up a simple...

How would one optimize conventional modern weapons for fighting robots

What is better: yes / no radio, or simple checkbox?

Where is the fallacy here?

How to approximate rolls for potions of healing using only d6's?

I encountered my boss during an on-site interview at another company. Should I bring it up when seeing him next time?

Pronunciation of powers

How to deny access to SQL Server to certain login over SSMS, but allow over .Net SqlClient Data Provider

Can I become debt free or should I file for bankruptcy? How do I manage my debt and finances?

Why does Starman/Roadster have radial acceleration?

How do I construct an nxn matrix?

How to properly claim credit for peer review?

How do ISS astronauts "get their stripes"?

Is my plan for fixing my water heater leak bad?

What's the difference between a cart and a wagon?

Compare four integers, return word based on maximum

Easy code troubleshooting in wordpress

How can I be pwned if I'm not registered on that site?

Make me a metasequence

Where is this triangular-shaped space station from?

Avoiding unpacking an array when altering its dimension

Accessing something inside the object when you don't know the key

Do Hexblade warlocks choose their spells from the Hexblade spell list or the warlock spell list?

How to count words in a line

Can you use a beast's innate abilities while polymorphed?



MySQL How to calculate Partnership Scores from Cricket ball by ball database [Solved]


Speeding up a simple select query on MariadbMySQL - Group By - How does it determine which row to return from joined tableTo find out the sum total of GRNQty and GRNValue of particular item from column 1Avoid redundancy in a database for a tournament software?MySQL join on hamming distanceMore Fields or multiple tablesBest practice for large databaseMySQL unknown column in subqueryCan I INSERT the result from a query INTO a new table with a TRIGGER?Rank users by different periods and overall













0















I'm trying to create a simple cricket application, where i will store all cricket records from a database. I collect a sample database with data from online and i successfully did some query but I'm unable to write the query for finding Partnership Scored for a match. I have no clue how can i do this.



Below is the three main Table which i will used to get the data:




1. ball_by_ball table, this table holds full information by ball by ball: enter image description here



2. batsman_scored, this table holds batsman run scores by ball by ball:



3. wicket_taken, this table hold wicket fallen information by ball by ball: enter image description here




I tried below query but I'm unable to group those properly



select P.Player_Name, P1.Player_Name, sum(b.runs_scored) as Runs
from ball_by_ball a
inner join batsman_scored b using (match_id, over_id, ball_id, innings_no)
inner join Player P on a.striker = P.Player_Id
inner join Player P1 on a.non_striker = P1.Player_Id
where a.match_id = 981018
and a.innings_no = 1 group by P.Player_Name, P1.Player_Name;


So this my output: (this is not what i want)
enter image description here




If you look above screenshot, there Row 1 and 2 will be same, AJ Finch BB McCullum and BB McCullum AJ Finch will be same row and the
Runs column will be sum. That's what i want but i'm unable to do it.




UPDATED- This is the finally query which gives the partnership information:



select P.Player_Name, Runs + Extra as Partnership, P1.Player_Name
from (select if(striker > non_striker,
concat(striker),
concat(non_striker)) as Bat1,
sum(b.runs_scored) as Runs,
ifnull(sum(e.extra_runs), 0) as Extra,
if(striker > non_striker,
concat(non_striker),
concat(striker)) as Bat2
from ball_by_ball a
left join batsman_scored b using (match_id, over_id, ball_id, innings_no)
left join extra_runs e using (match_id, over_id, ball_id, innings_no)
where a.match_id = 981020
and a.innings_no = 1
group by if(striker > non_striker,
concat(striker, '-', non_striker),
concat(non_striker, '-', striker)), Bat1, Bat2) as t
inner join Player P on t.Bat1 = P.Player_Id
inner join Player P1 on t.Bat2 = P1.Player_Id;



This is the final output which i wanted: enter image description here











share|improve this question









New contributor




Rhidoy is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

























    0















    I'm trying to create a simple cricket application, where i will store all cricket records from a database. I collect a sample database with data from online and i successfully did some query but I'm unable to write the query for finding Partnership Scored for a match. I have no clue how can i do this.



    Below is the three main Table which i will used to get the data:




    1. ball_by_ball table, this table holds full information by ball by ball: enter image description here



    2. batsman_scored, this table holds batsman run scores by ball by ball:



    3. wicket_taken, this table hold wicket fallen information by ball by ball: enter image description here




    I tried below query but I'm unable to group those properly



    select P.Player_Name, P1.Player_Name, sum(b.runs_scored) as Runs
    from ball_by_ball a
    inner join batsman_scored b using (match_id, over_id, ball_id, innings_no)
    inner join Player P on a.striker = P.Player_Id
    inner join Player P1 on a.non_striker = P1.Player_Id
    where a.match_id = 981018
    and a.innings_no = 1 group by P.Player_Name, P1.Player_Name;


    So this my output: (this is not what i want)
    enter image description here




    If you look above screenshot, there Row 1 and 2 will be same, AJ Finch BB McCullum and BB McCullum AJ Finch will be same row and the
    Runs column will be sum. That's what i want but i'm unable to do it.




    UPDATED- This is the finally query which gives the partnership information:



    select P.Player_Name, Runs + Extra as Partnership, P1.Player_Name
    from (select if(striker > non_striker,
    concat(striker),
    concat(non_striker)) as Bat1,
    sum(b.runs_scored) as Runs,
    ifnull(sum(e.extra_runs), 0) as Extra,
    if(striker > non_striker,
    concat(non_striker),
    concat(striker)) as Bat2
    from ball_by_ball a
    left join batsman_scored b using (match_id, over_id, ball_id, innings_no)
    left join extra_runs e using (match_id, over_id, ball_id, innings_no)
    where a.match_id = 981020
    and a.innings_no = 1
    group by if(striker > non_striker,
    concat(striker, '-', non_striker),
    concat(non_striker, '-', striker)), Bat1, Bat2) as t
    inner join Player P on t.Bat1 = P.Player_Id
    inner join Player P1 on t.Bat2 = P1.Player_Id;



    This is the final output which i wanted: enter image description here











    share|improve this question









    New contributor




    Rhidoy is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.























      0












      0








      0








      I'm trying to create a simple cricket application, where i will store all cricket records from a database. I collect a sample database with data from online and i successfully did some query but I'm unable to write the query for finding Partnership Scored for a match. I have no clue how can i do this.



      Below is the three main Table which i will used to get the data:




      1. ball_by_ball table, this table holds full information by ball by ball: enter image description here



      2. batsman_scored, this table holds batsman run scores by ball by ball:



      3. wicket_taken, this table hold wicket fallen information by ball by ball: enter image description here




      I tried below query but I'm unable to group those properly



      select P.Player_Name, P1.Player_Name, sum(b.runs_scored) as Runs
      from ball_by_ball a
      inner join batsman_scored b using (match_id, over_id, ball_id, innings_no)
      inner join Player P on a.striker = P.Player_Id
      inner join Player P1 on a.non_striker = P1.Player_Id
      where a.match_id = 981018
      and a.innings_no = 1 group by P.Player_Name, P1.Player_Name;


      So this my output: (this is not what i want)
      enter image description here




      If you look above screenshot, there Row 1 and 2 will be same, AJ Finch BB McCullum and BB McCullum AJ Finch will be same row and the
      Runs column will be sum. That's what i want but i'm unable to do it.




      UPDATED- This is the finally query which gives the partnership information:



      select P.Player_Name, Runs + Extra as Partnership, P1.Player_Name
      from (select if(striker > non_striker,
      concat(striker),
      concat(non_striker)) as Bat1,
      sum(b.runs_scored) as Runs,
      ifnull(sum(e.extra_runs), 0) as Extra,
      if(striker > non_striker,
      concat(non_striker),
      concat(striker)) as Bat2
      from ball_by_ball a
      left join batsman_scored b using (match_id, over_id, ball_id, innings_no)
      left join extra_runs e using (match_id, over_id, ball_id, innings_no)
      where a.match_id = 981020
      and a.innings_no = 1
      group by if(striker > non_striker,
      concat(striker, '-', non_striker),
      concat(non_striker, '-', striker)), Bat1, Bat2) as t
      inner join Player P on t.Bat1 = P.Player_Id
      inner join Player P1 on t.Bat2 = P1.Player_Id;



      This is the final output which i wanted: enter image description here











      share|improve this question









      New contributor




      Rhidoy is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.












      I'm trying to create a simple cricket application, where i will store all cricket records from a database. I collect a sample database with data from online and i successfully did some query but I'm unable to write the query for finding Partnership Scored for a match. I have no clue how can i do this.



      Below is the three main Table which i will used to get the data:




      1. ball_by_ball table, this table holds full information by ball by ball: enter image description here



      2. batsman_scored, this table holds batsman run scores by ball by ball:



      3. wicket_taken, this table hold wicket fallen information by ball by ball: enter image description here




      I tried below query but I'm unable to group those properly



      select P.Player_Name, P1.Player_Name, sum(b.runs_scored) as Runs
      from ball_by_ball a
      inner join batsman_scored b using (match_id, over_id, ball_id, innings_no)
      inner join Player P on a.striker = P.Player_Id
      inner join Player P1 on a.non_striker = P1.Player_Id
      where a.match_id = 981018
      and a.innings_no = 1 group by P.Player_Name, P1.Player_Name;


      So this my output: (this is not what i want)
      enter image description here




      If you look above screenshot, there Row 1 and 2 will be same, AJ Finch BB McCullum and BB McCullum AJ Finch will be same row and the
      Runs column will be sum. That's what i want but i'm unable to do it.




      UPDATED- This is the finally query which gives the partnership information:



      select P.Player_Name, Runs + Extra as Partnership, P1.Player_Name
      from (select if(striker > non_striker,
      concat(striker),
      concat(non_striker)) as Bat1,
      sum(b.runs_scored) as Runs,
      ifnull(sum(e.extra_runs), 0) as Extra,
      if(striker > non_striker,
      concat(non_striker),
      concat(striker)) as Bat2
      from ball_by_ball a
      left join batsman_scored b using (match_id, over_id, ball_id, innings_no)
      left join extra_runs e using (match_id, over_id, ball_id, innings_no)
      where a.match_id = 981020
      and a.innings_no = 1
      group by if(striker > non_striker,
      concat(striker, '-', non_striker),
      concat(non_striker, '-', striker)), Bat1, Bat2) as t
      inner join Player P on t.Bat1 = P.Player_Id
      inner join Player P1 on t.Bat2 = P1.Player_Id;



      This is the final output which i wanted: enter image description here








      mysql mysql-8.0






      share|improve this question









      New contributor




      Rhidoy is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question









      New contributor




      Rhidoy is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question








      edited 3 mins ago







      Rhidoy













      New contributor




      Rhidoy is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 17 hours ago









      RhidoyRhidoy

      33




      33




      New contributor




      Rhidoy is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      Rhidoy is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      Rhidoy is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















          1 Answer
          1






          active

          oldest

          votes


















          0














          Your grouping is a player pair so your GROUP BY expression needs to reflect this. The striker / non_striker must combined form a unique value. Start with an IF statement to avoid duplicates. I've used a mathematical expression that won't cause duplicates.



          So with your query use the following group by:



          GROUP BY IF(striker > non_striker,
          striker * 30 + non_striker,
          non_striker * 30 + striker)


          This works because assuming all player ids are < 30. If this isn't the case it can be replaced by a higher value.



          Alternately you could use a string based mechanism to get 1-2 as unique identifier. Note a separator - is needed (and can be anything not in the result set), otherwise striker,non_striker value 1,234 would be grouped the same as 12,34



          GROUP BY IF(striker > non_striker,
          CONCAT(striker, '-', non_striker),
          CONCAT(non_striker, '-', striker)





          share|improve this answer


























          • well this works only when i don't select striker or non_striker in output, when i select those i have to add those in group by clause thus my result grouped by striker or non_striker and result be the same as my question showing result. so how can i get striker and no_striker by using your solution? or is my query is wrong?

            – Rhidoy
            1 hour ago











          • this is my query by your solution select sum(b.runs_scored) as Runs from ball_by_ball a left join batsman_scored b using (match_id, over_id, ball_id, innings_no) inner join Player P on a.striker = P.Player_Id inner join Player P1 on a.non_striker = P1.Player_Id where a.match_id = 981018 and a.innings_no = 1 group by if(striker > non_striker, concat(striker, '-', non_striker), concat(non_striker, '-', striker));

            – Rhidoy
            1 hour ago











          • You could add the SELECT IF(....) as bater_ids ... GROUP BY bater_ids but, no grouping or listing them individually doesn't make sense.

            – danblack
            1 hour ago











          • thank you so much for your time, i make it as answer. without those ids its not clear who is batting. finally the problem solve and i update final query in my question, please have a look at it.

            – Rhidoy
            2 mins ago











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "182"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });






          Rhidoy is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f231237%2fmysql-how-to-calculate-partnership-scores-from-cricket-ball-by-ball-database-so%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          Your grouping is a player pair so your GROUP BY expression needs to reflect this. The striker / non_striker must combined form a unique value. Start with an IF statement to avoid duplicates. I've used a mathematical expression that won't cause duplicates.



          So with your query use the following group by:



          GROUP BY IF(striker > non_striker,
          striker * 30 + non_striker,
          non_striker * 30 + striker)


          This works because assuming all player ids are < 30. If this isn't the case it can be replaced by a higher value.



          Alternately you could use a string based mechanism to get 1-2 as unique identifier. Note a separator - is needed (and can be anything not in the result set), otherwise striker,non_striker value 1,234 would be grouped the same as 12,34



          GROUP BY IF(striker > non_striker,
          CONCAT(striker, '-', non_striker),
          CONCAT(non_striker, '-', striker)





          share|improve this answer


























          • well this works only when i don't select striker or non_striker in output, when i select those i have to add those in group by clause thus my result grouped by striker or non_striker and result be the same as my question showing result. so how can i get striker and no_striker by using your solution? or is my query is wrong?

            – Rhidoy
            1 hour ago











          • this is my query by your solution select sum(b.runs_scored) as Runs from ball_by_ball a left join batsman_scored b using (match_id, over_id, ball_id, innings_no) inner join Player P on a.striker = P.Player_Id inner join Player P1 on a.non_striker = P1.Player_Id where a.match_id = 981018 and a.innings_no = 1 group by if(striker > non_striker, concat(striker, '-', non_striker), concat(non_striker, '-', striker));

            – Rhidoy
            1 hour ago











          • You could add the SELECT IF(....) as bater_ids ... GROUP BY bater_ids but, no grouping or listing them individually doesn't make sense.

            – danblack
            1 hour ago











          • thank you so much for your time, i make it as answer. without those ids its not clear who is batting. finally the problem solve and i update final query in my question, please have a look at it.

            – Rhidoy
            2 mins ago
















          0














          Your grouping is a player pair so your GROUP BY expression needs to reflect this. The striker / non_striker must combined form a unique value. Start with an IF statement to avoid duplicates. I've used a mathematical expression that won't cause duplicates.



          So with your query use the following group by:



          GROUP BY IF(striker > non_striker,
          striker * 30 + non_striker,
          non_striker * 30 + striker)


          This works because assuming all player ids are < 30. If this isn't the case it can be replaced by a higher value.



          Alternately you could use a string based mechanism to get 1-2 as unique identifier. Note a separator - is needed (and can be anything not in the result set), otherwise striker,non_striker value 1,234 would be grouped the same as 12,34



          GROUP BY IF(striker > non_striker,
          CONCAT(striker, '-', non_striker),
          CONCAT(non_striker, '-', striker)





          share|improve this answer


























          • well this works only when i don't select striker or non_striker in output, when i select those i have to add those in group by clause thus my result grouped by striker or non_striker and result be the same as my question showing result. so how can i get striker and no_striker by using your solution? or is my query is wrong?

            – Rhidoy
            1 hour ago











          • this is my query by your solution select sum(b.runs_scored) as Runs from ball_by_ball a left join batsman_scored b using (match_id, over_id, ball_id, innings_no) inner join Player P on a.striker = P.Player_Id inner join Player P1 on a.non_striker = P1.Player_Id where a.match_id = 981018 and a.innings_no = 1 group by if(striker > non_striker, concat(striker, '-', non_striker), concat(non_striker, '-', striker));

            – Rhidoy
            1 hour ago











          • You could add the SELECT IF(....) as bater_ids ... GROUP BY bater_ids but, no grouping or listing them individually doesn't make sense.

            – danblack
            1 hour ago











          • thank you so much for your time, i make it as answer. without those ids its not clear who is batting. finally the problem solve and i update final query in my question, please have a look at it.

            – Rhidoy
            2 mins ago














          0












          0








          0







          Your grouping is a player pair so your GROUP BY expression needs to reflect this. The striker / non_striker must combined form a unique value. Start with an IF statement to avoid duplicates. I've used a mathematical expression that won't cause duplicates.



          So with your query use the following group by:



          GROUP BY IF(striker > non_striker,
          striker * 30 + non_striker,
          non_striker * 30 + striker)


          This works because assuming all player ids are < 30. If this isn't the case it can be replaced by a higher value.



          Alternately you could use a string based mechanism to get 1-2 as unique identifier. Note a separator - is needed (and can be anything not in the result set), otherwise striker,non_striker value 1,234 would be grouped the same as 12,34



          GROUP BY IF(striker > non_striker,
          CONCAT(striker, '-', non_striker),
          CONCAT(non_striker, '-', striker)





          share|improve this answer















          Your grouping is a player pair so your GROUP BY expression needs to reflect this. The striker / non_striker must combined form a unique value. Start with an IF statement to avoid duplicates. I've used a mathematical expression that won't cause duplicates.



          So with your query use the following group by:



          GROUP BY IF(striker > non_striker,
          striker * 30 + non_striker,
          non_striker * 30 + striker)


          This works because assuming all player ids are < 30. If this isn't the case it can be replaced by a higher value.



          Alternately you could use a string based mechanism to get 1-2 as unique identifier. Note a separator - is needed (and can be anything not in the result set), otherwise striker,non_striker value 1,234 would be grouped the same as 12,34



          GROUP BY IF(striker > non_striker,
          CONCAT(striker, '-', non_striker),
          CONCAT(non_striker, '-', striker)






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 7 hours ago

























          answered 8 hours ago









          danblackdanblack

          1,9391213




          1,9391213













          • well this works only when i don't select striker or non_striker in output, when i select those i have to add those in group by clause thus my result grouped by striker or non_striker and result be the same as my question showing result. so how can i get striker and no_striker by using your solution? or is my query is wrong?

            – Rhidoy
            1 hour ago











          • this is my query by your solution select sum(b.runs_scored) as Runs from ball_by_ball a left join batsman_scored b using (match_id, over_id, ball_id, innings_no) inner join Player P on a.striker = P.Player_Id inner join Player P1 on a.non_striker = P1.Player_Id where a.match_id = 981018 and a.innings_no = 1 group by if(striker > non_striker, concat(striker, '-', non_striker), concat(non_striker, '-', striker));

            – Rhidoy
            1 hour ago











          • You could add the SELECT IF(....) as bater_ids ... GROUP BY bater_ids but, no grouping or listing them individually doesn't make sense.

            – danblack
            1 hour ago











          • thank you so much for your time, i make it as answer. without those ids its not clear who is batting. finally the problem solve and i update final query in my question, please have a look at it.

            – Rhidoy
            2 mins ago



















          • well this works only when i don't select striker or non_striker in output, when i select those i have to add those in group by clause thus my result grouped by striker or non_striker and result be the same as my question showing result. so how can i get striker and no_striker by using your solution? or is my query is wrong?

            – Rhidoy
            1 hour ago











          • this is my query by your solution select sum(b.runs_scored) as Runs from ball_by_ball a left join batsman_scored b using (match_id, over_id, ball_id, innings_no) inner join Player P on a.striker = P.Player_Id inner join Player P1 on a.non_striker = P1.Player_Id where a.match_id = 981018 and a.innings_no = 1 group by if(striker > non_striker, concat(striker, '-', non_striker), concat(non_striker, '-', striker));

            – Rhidoy
            1 hour ago











          • You could add the SELECT IF(....) as bater_ids ... GROUP BY bater_ids but, no grouping or listing them individually doesn't make sense.

            – danblack
            1 hour ago











          • thank you so much for your time, i make it as answer. without those ids its not clear who is batting. finally the problem solve and i update final query in my question, please have a look at it.

            – Rhidoy
            2 mins ago

















          well this works only when i don't select striker or non_striker in output, when i select those i have to add those in group by clause thus my result grouped by striker or non_striker and result be the same as my question showing result. so how can i get striker and no_striker by using your solution? or is my query is wrong?

          – Rhidoy
          1 hour ago





          well this works only when i don't select striker or non_striker in output, when i select those i have to add those in group by clause thus my result grouped by striker or non_striker and result be the same as my question showing result. so how can i get striker and no_striker by using your solution? or is my query is wrong?

          – Rhidoy
          1 hour ago













          this is my query by your solution select sum(b.runs_scored) as Runs from ball_by_ball a left join batsman_scored b using (match_id, over_id, ball_id, innings_no) inner join Player P on a.striker = P.Player_Id inner join Player P1 on a.non_striker = P1.Player_Id where a.match_id = 981018 and a.innings_no = 1 group by if(striker > non_striker, concat(striker, '-', non_striker), concat(non_striker, '-', striker));

          – Rhidoy
          1 hour ago





          this is my query by your solution select sum(b.runs_scored) as Runs from ball_by_ball a left join batsman_scored b using (match_id, over_id, ball_id, innings_no) inner join Player P on a.striker = P.Player_Id inner join Player P1 on a.non_striker = P1.Player_Id where a.match_id = 981018 and a.innings_no = 1 group by if(striker > non_striker, concat(striker, '-', non_striker), concat(non_striker, '-', striker));

          – Rhidoy
          1 hour ago













          You could add the SELECT IF(....) as bater_ids ... GROUP BY bater_ids but, no grouping or listing them individually doesn't make sense.

          – danblack
          1 hour ago





          You could add the SELECT IF(....) as bater_ids ... GROUP BY bater_ids but, no grouping or listing them individually doesn't make sense.

          – danblack
          1 hour ago













          thank you so much for your time, i make it as answer. without those ids its not clear who is batting. finally the problem solve and i update final query in my question, please have a look at it.

          – Rhidoy
          2 mins ago





          thank you so much for your time, i make it as answer. without those ids its not clear who is batting. finally the problem solve and i update final query in my question, please have a look at it.

          – Rhidoy
          2 mins ago










          Rhidoy is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          Rhidoy is a new contributor. Be nice, and check out our Code of Conduct.













          Rhidoy is a new contributor. Be nice, and check out our Code of Conduct.












          Rhidoy is a new contributor. Be nice, and check out our Code of Conduct.
















          Thanks for contributing an answer to Database Administrators Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f231237%2fmysql-how-to-calculate-partnership-scores-from-cricket-ball-by-ball-database-so%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Anexo:Material bélico de la Fuerza Aérea de Chile Índice Aeronaves Defensa...

          Always On Availability groups resolving state after failover - Remote harden of transaction...

          update json value to null Announcing the arrival of Valued Associate #679: Cesar Manara ...