/****** SSMS 的 SelectTopNRows 命令的脚本 ******/
SELECT TOP (1000) [Id]
,[PartnerId]
,[TrackingId]
,[DeviceUuid]
,[Mobile]
,[Brand]
,[Model]
,[Os]
,[OsVersion]
,[WeiXinVersion]
,[Longitude]
,[Latitude]
,[IsOnline]
,[Approved]
,[Deleted]
,[CreateTime]
,[UpdateTime]
,[Memo]
,[LastSyncContactTime]
,[DeviceGroupId]
,[AssistantVersion]
,[ListType]
,[PartnerSerialKeyId]
FROM [IFengKe].[dbo].[Device]
where [Id]=7
or [Id]=8
for json path,INCLUDE_NULL_VALUES
下面是 json 嵌套方法
SELECT v.*
FROM
(
SELECT o.org_id,
o.org_name,
e.emp_id,
e.emp_name
FROM tb_org o
INNER JOIN tb_emp e
ON o.emp_id = e.emp_id
WHERE o.org_id IN (1,2)
FOR JSON AUTO
)v(json_date)