select jsonb_agg(data)
from (
select jsonb_build_object(
'MobileOperator', MobileOperator,
'MobileQCellCore', MobileQCellCore,
'data', jsonb_agg(jsonb_build_object('UpdateTime', UpdateTime, 'Parvalue', Parvalue,'ProductState', ProductState) order by UpdateTime)) as data
from ods_tsc_product_info
where merchantid = 'xxxxxxxx' and productcategory = 'xxxxxxxx'
group by MobileOperator, MobileQCellCore
) temp
Postgres SQL 构建json对象
最新推荐文章于 2024-09-04 13:58:18 发布