Re: JSON query help

Gavin Henry <[email protected]> Thu, 29 Aug 2019 23:01:01 +0100
Newsgroups gmane.comp.db.postgresql.novice
Message-ID <CAA8_NKD9vQTSe8b9fzsUChvWQi6OBgvJLY=oRPTo3TU6QqNiUg@mail.gmail.com>
Any pointers for below docs wise? Thanks!

On Thu, 29 Aug 2019 at 00:37, Gavin Henry <[email protected]> wrote:

> Thanks, that worked! Now I need to go back to basics and SETS:
>
> SELECT
>
> cost_details->'Accounting'->jsonb_object_keys(cost_details->'Accounting')->'BalanceUUID'
> AS BalanceUUID,
>
> cost_details->'Accounting'->jsonb_object_keys(cost_details->'Accounting')->'Units'
> AS Cost
> FROM cdrs
> WHERE cost > 0
> AND cost_details->'AccountSummary'->'BalanceSummaries' @>
> '[{"ID":"B_MONETARY_POSTPAID"}]'
> AND cost_details->'AccountSummary'->'BalanceSummaries' @>
> json_build_object('UUID',
>
> cost_details->'Accounting'->jsonb_object_keys(cost_details->'Accounting')->'BalanceUUID')::jsonb
> limit 1;
> ERROR:  argument of AND must not return a set
> LINE 1: ...ummaries' @> '[{"ID":"B_MONETARY_POSTPAID"}]' AND cost_detai...
>
-- 
http://www.suretecsystems.com/services/openldap/
http://www.surevoip.co.uk