I am trying to use OpenJSON at JSON data but it is not producing the result as expected. DB JSON in field_data is:
{
"name":"Test",
"Cell-Number":"Test",
"CNIC":"12112112",
"Person-Name":"Test",
"Focal-person-cell-phone":"121212",
"Focal-person-CNIC":"12121212",
"Religion":"Test",
"Total-teachers":"4",
"Total-students":"37",
"Total-Hosteled-students":"11",
"Government-\/-Private":"Govt",
"Category":"Jamia",
"Total-Gates":"3",
"Registration-number":"211121",
"Security-guard\/watchman":"10",
"Condition":"Test"
}
I am trying to fetch the data where name is equal to Test in field_data column. My Query to fetch data is ;
SELECT *
FROM beat_data
WHERE EXISTS (
Select *
FROM OPENJSON(field_data,'$.name')
WHERE Value = 'Test'
)
I have feelings that I am not using the path properly.