Skip to content Skip to sidebar Skip to footer

Select From ... - Based On A Value In Json Format

Let's say I have a database table with several common columns such as name, gender, age, ... Besides I have an additional column using the JSON datatype (available from Postgres 9.

Solution 1:

If I understood the manual correctly, you can access JSON fields with -> and ->> operators. The query would look like:

SELECT *
FROM your_table
WHERE json_field ->> 'occupation' = 'football';

Post a Comment for "Select From ... - Based On A Value In Json Format"