> ## Content Index
> Fetch the complete content index at: https://www.bagz.fr/llms.txt
> Use this file to discover other available public pages before exploring further.

# PostgreSQL - Check value is in array
- URL: https://www.bagz.fr/postgresql-check-value-is-in-array/
- Published: 2016-11-07T09:57:41.000Z
- Updated: 2016-11-07T09:57:41.000Z
- Author: bgazui
- Tags: Database, #Migrated-1790668826633, #wp, #wp-post, #Import 2026-09-29 08:00

With PostgreSQL, if you have a field containing an Array and you want to get all the results containing this value in the array, you can use the following command.

Here, we are looking for all the results in the table **my\_table** containing **my\_value** in the field **my\_array**.

SELECT \* FROM my\_table WHERE 'my\_value'=ANY(my\_array) ORDER BY id;  
  
 id | type | title | my\_array   
\-------+--------------------+-------------------------------+------------------------------------  
 93646 | this\_is\_my\_type | this\_is\_my\_title | {my\_1,my\_2,my\_3,my\_value,my\_4,my\_5}  
 94184 | this\_is\_my\_type | this\_is\_my\_title2 | {my\_3,my\_value,my\_4,my\_5}  
 98240 | this\_is\_my\_type | this\_is\_my\_title3 | {my\_1,my\_2,my\_3,my\_value}