data row 1 :
{
"30":{"status":0,"approval":"0","entrydate":"2023-01-30"},
"26":{"status":0,"approval":"0","entrydate":"2023-01-30"}
}
data row 2 :
{
"12":{"status":0,"approval":"0","entrydate":"2023-01-30"},
"13":{"status":1,"approval":"20022-xxxx","entrydate":"2023-01-30"}
}
data row 3 :
{
"20":{"status":1,"approval":"20022-xxxx","entrydate":"2023-01-30"},
"24":{"status":1,"approval":"20022-xxxx","entrydate":"2023-01-30"}
}
如何在status=1
=〉row 2
,row 3
以及status=0
=〉row 1
,row 2
的情况下选择SQL Server数据库中的行数据,因为json键是动态的。
1条答案
按热度按时间ktecyv1j1#
一种可能的方法是
OPENJSON()
和JSON_VALUE()
的组合: