Point Adding

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
sk8erh4x0r
Forum Commoner
Posts: 43
Joined: Wed May 26, 2004 8:27 pm

Point Adding

Post by sk8erh4x0r »

I'm trying to add up 2 columns that are in 2 different tables:

points in `hof` and score in `mission_scores`

Is there a way to do this with one query or do i need to run 2 different queries and add them together?
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

moved to db forum
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

what database are you using?
sk8erh4x0r
Forum Commoner
Posts: 43
Joined: Wed May 26, 2004 8:27 pm

Post by sk8erh4x0r »

both tables are under the same database
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

well, I meant 'What db engine, MySQL, MSSQL, Oracle or something?'
sk8erh4x0r
Forum Commoner
Posts: 43
Joined: Wed May 26, 2004 8:27 pm

Post by sk8erh4x0r »

mysql
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post by JAM »

?

Code: Select all

select
 (hof.points + mission_scores.score) as named
from
 hof, mission_scores
...or if using something to identify what rows to add...

Code: Select all

select
 (hof.points + mission_scores.score) as named
from
 hof
inner join mission_scores on mission_scores.id = hof.id
Post Reply