|
-
Oct 26th, 2016, 04:28 PM
#1
Thread Starter
New Member
Find SUM of SOME columns from two mysql tables?
Hi!
So, I have two tables, exam1 and exam2 which looks like these:
Code:
table:exam1
sid physics chemistry biology
3 80 60 40
Code:
table:exam2
sid physics chemistry biology
3 40 50 70
Problem:
I want to find the sum of items from both tables (exam1 and exam2), like this
Code:
table: total
sid physics chemistry biology
3 120 110 110
BUT:
I wont always have to find total of all courses (physics, chemistry, biology), sometimes I may want to find sum of only two, one of all three subjects, so this is really a variable.
Since I program from VB.NET, the list of courses to be totaled can be specified by a user at run time and is kept in a variable say, "courses", so sometimes courses= (physics,chemistry,biology) sometimes courses=(physics,chemistry) and so on.
How can I then find a total of courses that the user selects? (still total of courses in exam1+exam2 tables)
Thanks
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|