如何用一句SQL查询不同条件的两列
selectAVG(landsqmi)AsLeftAreafromspatial.us_stateswhereST_Xmax(geom)<-91.512817andlan...
select AVG(landsqmi) As LeftArea from spatial.us_states where ST_Xmax(geom)<-91.512817 and landsqmi>0;
select AVG(landsqmi) As RightArea from spatial.us_states where ST_XMin(geom)>-87.495491 and landsqmi>0;
这是我的两个要查询的列,这两个语句怎么合并成一句SQL? 展开
select AVG(landsqmi) As RightArea from spatial.us_states where ST_XMin(geom)>-87.495491 and landsqmi>0;
这是我的两个要查询的列,这两个语句怎么合并成一句SQL? 展开
3个回答
展开全部
select
avg(case when ST_Xmax(geom)<-91.512817 and landsqmi>0 then landsqmi end) as LeftArea,
avg(case when ST_XMin(geom)>-87.495491 and landsqmi>0 then landsqmi end) as LeftArea
from
spatial.us_states
avg(case when ST_Xmax(geom)<-91.512817 and landsqmi>0 then landsqmi end) as LeftArea,
avg(case when ST_XMin(geom)>-87.495491 and landsqmi>0 then landsqmi end) as LeftArea
from
spatial.us_states
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
从表1一,表1 b,其中a.column1 =条件1和b.column2 =条件2选择A.1,B.1;
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询