简体   繁体   中英

postgresql search column with integer[] with another array

I am trying to figure out a way that I can search a column containing an array of integers. For example, column a -> [1,2]. Using another array, ex: b -> [1,2,3]

If all the values in a are in the array b, I want to return that result.

I've tried using unnest and = ANY but to no avail. Does anyone else have a solution to this?

您可以使用“包含”运算符@>

array[1,2,3] @> array[1,2]

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