|
本帖最后由 sheeboard 于 2019-11-4 20:47 编辑
create table temptable select province,group_concat(if(crops='shuidao',weight,NULL)) as 'shuidao',group_concat(if(crops='xiaomai',weight,NULL)) as 'xiaomai' from farm group by province;
select * from temptable where cast(xiaomai as decimal(10,2)) > cast(shuidao as decimal(10,2));
用了两句,参考一下
|
|