简体   繁体   中英

JSONB column query

There is a JSONB column ( some_strings ) that has value like string array

---------------------
["string1","string2","string3"]
["string5"]
["string6","string7"]

-------etc-----------

Is there a way to make a query to get row where (some_strings) contain "string2" ?

This query will return records where string2 appears anywhere in the JSONB array:

SELECT *
FROM yourTable
WHERE some_strings ?& array['string2']

Documentation

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM