1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How to Take sum of Individual Rows

Discussion in 'Databases' started by Taruna P, Nov 17, 2014.

  1. #1
    Hi All,

    I want the query to take the sum of individual rows.

    e.g:
    Column1 Column2
    123 132 want the sum of 123+132=255
    213 321 213+321=534

    Please help..
    Thanks in Advance.
     
    Taruna P, Nov 17, 2014 IP
  2. usemyteam

    usemyteam Member

    Messages:
    218
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    43
    #2
    Are you referring to an excel spreadsheet?
     
    usemyteam, Nov 17, 2014 IP
  3. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #3
    Most databases would be something like this:

    SELECT (Column1 + Column2) AS column_total FROM my_table;
     
    jestep, Nov 17, 2014 IP
  4. Taruna P

    Taruna P Greenhorn

    Messages:
    13
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    13
    #4
    No I am asking about the Mysql query.
     
    Taruna P, Nov 22, 2014 IP
  5. ghost.rider

    ghost.rider Active Member

    Messages:
    134
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    75
    Digital Goods:
    2
    #5
    SELECT Column1, Column2,Column3,(Column1 + Column2 + Column3) as 'Total' FROM 'yourtablename'
     
    ghost.rider, Nov 22, 2014 IP
  6. usemyteam

    usemyteam Member

    Messages:
    218
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    43
    #6
    Oops. Wrong move. Sorry.
     
    usemyteam, Nov 24, 2014 IP