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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T02:47:47+00:00 2026-06-03T02:47:47+00:00

THE PROBLEM I have four game servers collecting data. Putting data into a single

  • 0

THE PROBLEM
I have four game servers collecting data. Putting data into a single table. Unfortunately this causes four entries per stat for one player.

WHAT I WANT
I want one record and SUM()on certain columns.

I will post a statement that I wrote which doesn’t work but you’ll get the point of what I would like to accomplish.

SELECT DISTINCT( Name ), 
               Max(Level), 
               Class, 
               Sum(Kills), 
               Sum(Deaths), 
               Sum(Points), 
               Sum(TotalTime), 
               Sum(TotalVisits), 
               CharacterID 
FROM   Characters 
WHERE  Name LIKE '$value%' 
        OR CharacterID LIKE '$value' 
ORDER  BY Name ASC; 
  • 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-03T02:47:48+00:00Added an answer on June 3, 2026 at 2:47 am

    Let me start by saying that duplicate rows in your database is truly less than ideal. A fully normalized database makes data much easier to manipulate without having random anomalies pop up.

    However, to answer your question, this is simply what dweiss said put into code (using group by):

    SELECT
      name,
      MAX(Level),
      Class,
      SUM(Kills),
      SUM(Deaths),
      SUM(Points),
      SUM(TotalTime),
      SUM(TotalVisits),
      CharacterID
    FROM
      Characters
    WHERE
      Name LIKE '$value%' OR CharacterID LIKE '$value'
    GROUP BY
      name,
      class,
      characterid
    ORDER BY
      Name ASC
    ;
    

    I’m assuming name, class, characterID, are all the same for each player, because that’s the only way to get those values in there. Otherwise you’ll have to use aggregate functions on them as well.

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

Sidebar

Related Questions

So I have four tables. Each table has a single id for the previous
I've seen that a few instances of this problem have been raised already. However,
Problem -- I have something like the following entries, 1000 of them: args1=msg args2=flow
Problem: I have a symfony project with a database full of production data I
I'm having a problem with assembly references. I have four assemblies: A class library
Let me explain my problem: I have four tables created as objects using Entity
In my script I have four functions that work like this: def function_four(): #
I will try to explain the problem that I have with this code. This
I have a problem with a simple file read. I have 4 four long
I need to solve the following problem. //pseudo algorithm you have four elements: elm1,

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.