Greetings!
I am using MySQL in RedHat 6.2 with PHP 4.0. I have a question on MySQL. Suppose I
have two tables A and B in my database:
Table A
Name Score
a45
b20
c75
d55
Table B
Name
First, get a book on SQL. Read about joins in SELECT statements.
Then, if you still need a quick answer, try the following:
INSERT INTO table_c(name, score)
SELECT name, a.score - b.score
FROM table_a a
LEFT JOIN table_b b ON b.name = a.name;
Hope that helps.
G'luck,
Peter
--
No language
Suppose you buy a book and learn how to do it.. rather than asking others
to solve your problem.
You've got MySQL and PHP.. so you should be able to do it..
Bye,
B.
I am using MySQL in RedHat 6.2 with PHP 4.0. I have a question on MySQL.
Suppose I have two tables A and B in my database:
On Tue, 10 Apr 2001, Peter Pentchev wrote:
First, get a book on SQL. Read about joins in SELECT statements.
Then, if you still need a quick answer, try the following:
INSERT INTO table_c(name, score)
SELECT name, a.score - b.score
FROM table_a a
LEFT JOIN table_b b ON b.name = a.name;