postgresql database json field query

select x.variable::json->>'imageId' as imageId, x.status, y.image_name
from task x join image y on x.variable::json->>'imageId' = y.image_id
where x.variable::json->>'imageId' is not null and x.status is not null and y.is_valid is true;

Among them, the variable field in the task table is a json string, through 

x.variable::json->>'imageId'

Get the image field in the json string and process it further.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325428840&siteId=291194637