sql-josn

时间:2021-10-09 08:18:32

1 select fname,fdistrict ,famount

from sale

for json auto---最简单方式[{"name":"name1",}]

2 select fname,fdistrict as sale.region,famount as sale.amount

from sale

for json path

[{"fname":"name1","sale":{"region":"region1","amount":"amount1"}}]

2 添加根结点

select fname,fdistrict as sale.region,famount as sale.amount

from sale

for json path,root("infomation")

{"infomation":[{"fname":"name1","sale":{"region":"region1","amount":"amount1"}}]}

相关文章