MySQL Forums
Forum List  »  Newbie

Re: MySQL Database Tables connect Help (JOIN / SUM)
Posted by: Peter Brawley
Date: July 23, 2018 12:34PM

This combines the two tables, and, once it's done renders table1 and table2 unnecessary ...
drop table if exists futbolseasons;
create table futbolseasons
select player, sum(goals)
from (
  select 1 as season, player, goals from table1
  union all
  select 2 as season, player, goals from table2
) sums
group by player;

Options: ReplyQuote


Subject
Written By
Posted
Re: MySQL Database Tables connect Help (JOIN / SUM)
July 23, 2018 12:34PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.