まず命題についてIDと名前に正規化が必要です
SQL
1create table user_table(id int primary key,name varchar(20));
2insert into user_table values(1,'たろう'),(2,'じろう');
3create table data_table(y date,id int,height double,unique(y,id));
4insert into data_table values('2016-01-01',1,140),('2016-01-01',2,150),('2017-01-01',1,142),('2017-01-01',2,153);
5
その上で、表示
SQL
1select y,t1.id,name,height from data_table as t1
2inner join user_table as t2 on t1.id=t2.id;
これを集計
SQL
1select t1.id,name
2,sum(height*(y='2016-01-01')) as h2016
3,sum(height*(y='2017-01-01')) as h2017
4 from user_table as t1
5inner join data_table as t2 on t1.id=t2.id
6group by id
7
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。