简体   繁体   中英

How select data in postgresql using ' where' array string element from jsonb fields?

在此处输入图像描述

i have table like above. i want to select the pengumuman field from table using one of element in array from office field. SELECT pengumuman from pengumuman_table where officee... and i don't know what the next to get data from array with element BWI. how fix that query? .thanks for your replay

If you want to search the array for a specific value, use any() :

select pengumuman
from pengumuman_table
where $1 = any(office)

$1 is the parameter to the query, a literal string to search for in the text arrays.

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