Hi,
es gibt ein Problem bei delivery_line: nach Company muss noch eine Klammer zu hinzugefügt werden..
Und zum Array:
Da kann man sich mit einem weiteren select + Json_arrayagg weiterhelfen. Sollte in etwa so aussehen:
Code:
json_object('Confirmation':
json_object(
'Datum': date, 'Header':
json_object(
'company': company),
'delivery_line': json_arrayagg(
json_object(
'package_number': trim(xpackage_no),
'country_of_origins':
(select json_arrayagg(
json_object(
'country_of_origin': trim(country_from),
'quantity_picked': trim(quan)
)
)
from qtemp/jsonout b
where a.date = b.date and
a.company = b.company and
a.xpackage_no = b.xpackage_no
) format json
))))
INTO :jsonfile
FROM qtemp/jsonout a
group by date, company;
Bookmarks