2017-03-23 12 views
0

私が引っ張ったいはどのようにJSON文字列の一部だけを選択して

{"nextPONumber":"3","poReportFooter":"This is the footer text for a purchase order report"} 

を返すフィールドを持っているだけで

「これは、発注レポートのフッターテキストです」
SELECT 
    modulesetting.value AS footer_value 
FROM modulesetting 
WHERE modulesetting.key='purchasing' 
+0

使用[組み込みJSON関数(https://www.postgresql.org/docs/9.3/static/functions -json.html)。 – amphetamachine

+0

フィールドの名前は何ですか? –

+0

フィールドは{"nextPONumber": "3"、 "poReportFooter": "これは購入注文レポートのフッタテキスト"}を返しますfooter_valueです –

答えて

0

野生の推測:

SELECT 
    modulesetting.value->>'poReportFooter' AS footer_value 
FROM modulesetting 
WHERE modulesetting.key='purchasing' 
関連する問題