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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T17:05:32+00:00 2026-06-07T17:05:32+00:00

I have a dataset which is not set out the best way see a

  • 0

I have a dataset which is not set out the best way see a sample of it below.

col1|col2|col3
john smith|10|3
tom smith|8|3
sean smith|12|3
sean smith|5|33
john smith|3|32
john smith|6|13

As you can see col1 has multiple records that are the same.

I want to be able to group all the entries with the same value in col1 and output then into the one row I also want to display another column which is the sum of col2*col3 so that my output would look like the below.

col1|col2|col3
john smith|19|48|912
sean smith|17|36|612
tom smith|8|3|24

Would it be best to use mySQL Sum here? How can I write this select statement when I don’t know what ‘WHERE’ will be but I just want it to output the result for each name?

  • 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-07T17:05:33+00:00Added an answer on June 7, 2026 at 5:05 pm

    You can do like this too ::

    Select 
    col1, SUM(col2), SUM(col3), SUM(col3)*SUM(col2) 
    from table group by col1
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following sample dataset (below and/or as CSVs here: http://goo.gl/wK57T ) which
I have an xml file which looks like the below example <Ids> <Id> <set>ai</set>
I have DataSet which has 3 columns. Name - insurance comp. name - treatmentDate
(Using Visual Studio 2005 / .NET 2.0) I have a DataSet which is being
I have a 2-class dataset on which I should apply a binary classification algorithm.
I have created a dataset in my visual studio project which is connected to
I have a moderately sized dataset in excel from which I wish to extract
Scenario I have a DevExpress DataGrid which is bound to a DataSet in C#.
I have a (disconnected) typed Dataset in an XML, which I query in LINQ:
I have a UltraWinGrid that is bound to a DataSet, in which a couple

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.