Answer the question
In order to leave comments, you need to log in
How to search table records by JSONB type field?
There is Laravel 7 and PostgresSQL 11 DBMS. It has a users table . The users table has a contacts field of type JSONB . The data structure in the contacts field is as follows:
{
"phones": [
{ "value": "89999999999" },
{ "value": "81111111111" }
]
}
Answer the question
In order to leave comments, you need to log in
SELECT * FROM table where data->'phones' @> '[{"value":"81111111111"}]'
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question