I am very new to MySQL and I am stuck on the next step. Say I have a table “EXAM” and there are 2 fields ("Subject and “Marks”).
EXAM
Subject Marks
English 50
Maths 50
Science 50
I think the query to get the sum total of Marks (which is 150) is:
SELECT SUM(Marks) FROM EXAM
In Xojo, this will be:
Dim rs as RecordSet
rs = mDB.SQLSelect(“SELECT SUM(Marks) FROM EXAM”)
Where in rs do I get the return result back?
I can’t seem to figure which “member” or rs. to look for. In fact, when I type rs. and hit the tab key, I can’t find the appropriate place to find the result that is returned.
Now I tried to see if there is a more efficient way to the final goal for the moment. I have 3 fields in the database that I want to get the sum back individually in 3 separate values.
I have done a fair amount of googling before this and if I may remember there may have been an example like:
SELECT SUM(Col1) SUM(Col2) SUM(Col3) FROM EXAM
Is this possible and if yes where to get the return values?
Thanks everyone. This is super. Due to my lack of MySQL syntax, I have been trying to do it going into loops the last few hours until I got very lost in the maze. This is real easy now.
Thanks for all the help. I still have some way to go. It is already 00.57am here.