我有一个类似的sql
select
cast (cast("cf00a399af"."2be9fc3823" as json) as row(cityId bigint, city varchar)) as
address,
count(0) as num
from ygg_dev."913852142333198336" cf00a399af
group by "cf00a399af"."2be9fc3823"
我的结果是这个
地址 | num |
---|---|
{cityid=44,城市=石家庄市} | 1 |
{cityid=23,城市=天津市} | 1 |
{cityid=1318,城市=泉州市} | 1 |
{cityid=0,city=} | 9 |
{cityid=1274,城市=福州市} | 1 |
{cityid=1318,城市=泉州市} | 1 |
{cityid=2,城市=北京市} | 1 |
{cityid=1318,城市=泉州市} | 2 |
"默认情况下";作为列的行字段名不区分大小写:
select r.cityId c1, r.CITYID c2, r.cityid c3
from (select cast(row(1, 'cityname') as row(cityId bigint, city varchar)) r) ;
输出:
c1 | c2 | c3 | |
---|---|---|---|
1 | 1 | 1 |