How to query on json data ?
hello,
I was loaded json data into flex table 
when i fetched days,it shows like this
how to in query on data array ??
ex: select maptostring(days=4) from testing_view ;
ERROR 4286: Operator does not exist: long varbinary = int
HINT: No operator matches the given name and argument type(s). You may need to add explicit type casts
How to query on this please provide a solution
Thanks in advance
0
Best Answer
-
I got the solution

select id from testing where mapcontainsvalue(__raw__['days'],'2')='t' ;
this will give u exact id's which 2 value contains
0
Answers
plz provide solution i need that query :'( #Jim_Knicely
Maybe the MAPITEMS function can help?
dbadmin=> select maptostring(days) from testing_view; maptostring --------------------------------------------------------------------------- { "0" : "3", "1" : "4", "2" : "5", "3" : "2", "4" : "3" } { "0" : "1", "1" : "2", "2" : "3", "3" : "1", "4" : "3" } (2 rows) dbadmin=> select values from (select mapitems(days) over(partition best)from testing_view) foo where keys = 4; values -------- 3 3 (2 rows) dbadmin=> select values from (select mapitems(days) over(partition best)from testing_view) foo where keys = 0; values -------- 3 1 (2 rows)