我现在有一张表,里面的信息是
country, country_code, year, forestation_area.
现在我要比较一下year=1990和year=2020年份的forestation_area的面积差值。
我的 想法是建立两张年份分别为1990 和 2020的子表,再把他们join起来,增加一列difference=1990.f - 2020.f
请问我的思路有问题吗? 语法用的是SQL server
感谢:)
我现在有一张表,里面的信息是
country, country_code, year, forestation_area.
现在我要比较一下year=1990和year=2020年份的forestation_area的面积差值。
我的 想法是建立两张年份分别为1990 和 2020的子表,再把他们join起来,增加一列difference=1990.f - 2020.f
请问我的思路有问题吗? 语法用的是SQL server
感谢:)
select *,a.forestation_area-b.forestation_area
from tableA a,tableA b
where a.year=1990 and b.year=2020 and a.country_code=b.country_code