If I had a db table with:
(Details being a JSON string)
Id Details Price
1 {"partNumber":"012345","qty":14} 14.99
2 {"partNumber":"22222","qty":11} 4.88
3 {"partNumber":"44444","qty":1} 3.24
4 {"partNumber":"72431223","qty":9} 3.33
5 {"partNumber":"98989","qty":1} 3.33
and I only wanted to return records where the quantity (qty) is 1.
So only return record with id 1 and 3.
So far I have got
select * from tableName where ('1') IN (select qty from OPENJSON(tableName.Details) WITH ( [qty] NVARCHAR(20) '$.qty'))
which is correctt, but what if I wanted to change the qty to return results with a quantity less than 10, so I would get records with id 3, 4 and 5 returned