actName | applicable | status | id |
-----------------------------------------------------
test1 | {"applicable":[1,3,7]} | 1 | 1 |
test2 | {"applicable":[5,4,1]} | 1 | 2 |
是否有可能在陣列適用檢查值?例如。如果我試圖找到哪一行包含整數值3
行列適用那麼它必須返回一行是第一行。如何使用WHERE子句來檢查值在Postgres的陣列存在
結果:
actName | applicable | status | id |
-----------------------------------------------------
test1 | {"applicable":[1,3,7]} | 1 | 1 |
我不是很熟悉Postgres的陣列,但是從第一眼我會嘗試'SELECT * FROM表WHERE適用LIKE '%,3%''。 –
PG版本? 'json'或'jsonb'類型的列'適用'? – Patrick
適用於'json'類型 –