Your code generates a cartesian products of both tables. Instead, you need to
join, using common column
inventory_id to relate the rows of the two tables:
select i.gold, c.char_name from inventory as i inner join character as c on c.inventory_id = i.inventory_id
character may have more than one match in
inventory, aggregation might be necessary:
select sum(i.gold) as gold, c.char_name from inventory as i inner join character as c on c.inventory_id = i.inventory_id group by c.char_name
However this is not what your question suggests. The first query should do what you want.
CLICK HERE to find out more related problems solutions.