I have a table that looks like the one below:

Name Score1 Score2 Score3 TOTAL
Dan 71 85 23 ?
Tom 58 84 87 ?
sam 76 65 64 ?

I dont know d command that will dynamically get the total score for each student and put it in the TOTAL Column. The datas are gotten from my database. Pls help me out...Thanks

Recommended Answers

All 2 Replies

select name, (score1+score2+score3)as total from table1

table1 - name of your table
hope this helps you

SELECT name,score1,score2,score3,cast(score1 as int)+cast(score2 as int)
+cast(score3 as int) as Total FROM table1

Here table1 is your table name.
as int for integer datatype you can change it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.