Home > Mobile >  Sql query to find value of key in json array which contains given string
Sql query to find value of key in json array which contains given string

Time:12-09

column name "note" - json type

data in one cell of the column is written in the following way :-

[
 {"text":"bbb","userID":"U001","time":16704,"showInReport":true},  
 {"text":"bb","userID":"U001","time":167047,"showInReport":true}
]

interval note column containing data

how to find value of key text which contains 'bb' which postgersql query can be used to find results

I used below query which works but if someone gives value as userid or text then it shows wrong result

I'm using Postgres 10.20 version

select distinct(workflowid) 
from cyto_records r 
  join cyto_record_results rr on (r.recordid = rr.recordid) 
where rr.interval_note::text LIKE '           
  • Related