I am trying to filter out records where one specific field has special characters with words in them.
For example: -[ RECORD 1 ]-------------- ------------------------------ id | 3151 description | Manual add from SCCM mac_address
| d4258be8d064 status | Unknown mac_vendor
| Intel Corporate added_by | Policy Manager added_at | 2019-02-19 14:29:21.802413 00 updated_at | 2022-10-19 10:57:15.960282 00 attributes | {"Our Device": "true"} extras | org_id | 1 permit_id | 1 agentless_managed_endpoint | 0
I tried
select * from tips_endpoints where description = 'Manual add from SCCM' AND attributes = '{"Our Device": "true"}';
but it fails.
I need to be able to find records where attributes has value = {"Our Device": "true"}
CodePudding user response:
Try this:
select * from tips_endpoints where description = 'Manual add from SCCM' AND attributes Like '%{"Our Device": "true"}%';
UPD, for Postgre:
select * from tips_endpoints where description = 'Manual add from SCCM' AND attributes::text Like '%{"Our Device": "true"}%';