sql-josn

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"}}]}

 

posted @ 2019-01-15 14:58  caojuanshu  阅读(144)  评论(0编辑  收藏  举报