I am having problems getting the net worth of a specific character in a game I am developing. I have two tables; one containing the character information and the other holding the characters business information. The network is determined by adding values of each of the characters business and adding the cash on hand of the character.
Here is the query I have already made:
SELECT SUM(`characters`.`cash`+`business`.`A`+(`business`.`B`*800)+(`business`.`C`*80)+(`business`.`D`*50)+(`business`.`E`*60)+(`business`.`F`*250)+(`business`.`G`*1000)+(`business`.`H`*1750)+(`business`.`I`*15000) ) AS `total` FROM `business` Inner Join `characters` ON `business`.`charID` = `characters`.`charID` WHERE `characters`.`charID` = '1'
Everything works just fine but the characters.cash is added to the total twice and it needs to be added once. The reason it is added twice is because the character has two businesses.
Any help that can be provided would be most appreciated.
Abarak