SQL DUPLICATE COLUMNS NEED HELP

  • Hi everyone I need help with sql select statement.I have table and in that table some columns have same value like:

    John 23

    Smith 36

    Suzan 21

    John 12

    and I don't know how to write select statement that would add columns with same name and select the other columns too.The result should be

    John 35

    Smith 36

    Suzan 21

    Please help.

    Thanks in advance

  • SELECT yourtable.name, Sum(yourtable.amount) As total

    FROM yourtable

    GROUP BY yourtable.name

    hope this helps

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

  • Thanks for your reply I solved my problem.

    Thanks!!

  • you're welcome

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply