× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



select json_arrayagg(
json_object('CustNo' :CUSNUM,
'LastName' :LSTNAM,
'Initials' :INIT,
'Street' :STREET,
'City' :CITY,
'State' :STATE,
'Zip' :ZIPCOD,
'CreditLimit' :CDTLMT,
'ChargeCode' :CHGCOD,
'Balance' :BALDUE,
'Credit' :CDTDUE
)
ORDER BY CUSNUM DESC
) as json
from QIWS.QCUSTCDT

It's right in the documentation for json_arrayagg:
[1]https://www.ibm.com/support/knowledgecenter/ssw_ibm_i_73/db2/rbafzcoljsonarrayagg.htm
;)



----- Original message -----
From: Justin Taylor <JUSTIN@xxxxxxxxxxxxx>
Sent by: "MIDRANGE-L" <midrange-l-bounces@xxxxxxxxxxxx>
To: "MIDRANGE-L (midrange-l@xxxxxxxxxxxx)" <midrange-l@xxxxxxxxxxxx>
Cc:
Subject: Sort JSON_OBJECT?
Date: Tue, Nov 7, 2017 3:27 PM

With the new JSON functions, does anyone know if you can sort the
results?
[2]https://www.ibm.com/developerworks/community/wikis/home?lang=en#!/wiki/IBM%20i%20Technology%20Updates/page/JSON%20Publishing%20Functions

Here's an example query using an IBM sample table. It seems to give the
correct results, but I need to be able to sort them.

select json_arrayagg(
json_object('CustNo' :CUSNUM,
'LastName' :LSTNAM,
'Initials' :INIT,
'Street' :STREET,
'City' :CITY,
'State' :STATE,
'Zip' :ZIPCOD,
'CreditLimit' :CDTLMT,
'ChargeCode' :CHGCOD,
'Balance' :BALDUE,
'Credit' :CDTDUE)
)
from QIWS.QCUSTCDT
where BALDUE > 0
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit:
[3]https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.midrange.com_mailman_listinfo_midrange-2Dl&d=DwICAg&c=jf_iaSHvJObTbx-siA1ZOg&r=2aXRESXNvBGuLbIQEybCPNLc7OK0UqjwsZsoCq7Jz6o&m=IQkB_ReAG5naSNPIsC_TWeMrlB6fgq7yejlo4lkVEok&s=PVv8fx5mGDHJ_8heNF4kZvRUE22sEX44zqPpQN8-pYw&e=
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at
[4]https://urldefense.proofpoint.com/v2/url?u=https-3A__archive.midrange.com_midrange-2Dl&d=DwICAg&c=jf_iaSHvJObTbx-siA1ZOg&r=2aXRESXNvBGuLbIQEybCPNLc7OK0UqjwsZsoCq7Jz6o&m=IQkB_ReAG5naSNPIsC_TWeMrlB6fgq7yejlo4lkVEok&s=u4sAYhCik2aZPMxd7Xn_4MCSXCpQKEjsON-Qwnh9sZY&e=.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link:
[5]https://urldefense.proofpoint.com/v2/url?u=http-3A__amzn.to_2dEadiD&d=DwICAg&c=jf_iaSHvJObTbx-siA1ZOg&r=2aXRESXNvBGuLbIQEybCPNLc7OK0UqjwsZsoCq7Jz6o&m=IQkB_ReAG5naSNPIsC_TWeMrlB6fgq7yejlo4lkVEok&s=vZJgxfhXYtZ-tzQOSn2LEiRcXYpNLYZIthPW_J_DJJU&e=




References

Visible links
1. https://www.ibm.com/support/knowledgecenter/ssw_ibm_i_73/db2/rbafzcoljsonarrayagg.htm
2. https://www.ibm.com/developerworks/community/wikis/home?lang=en#!/wiki/IBM%20i%20Technology%20Updates/page/JSON%20Publishing%20Functions
3. https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.midrange.com_mailman_listinfo_midrange-2Dl&d=DwICAg&c=jf_iaSHvJObTbx-siA1ZOg&r=2aXRESXNvBGuLbIQEybCPNLc7OK0UqjwsZsoCq7Jz6o&m=IQkB_ReAG5naSNPIsC_TWeMrlB6fgq7yejlo4lkVEok&s=PVv8fx5mGDHJ_8heNF4kZvRUE22sEX44zqPpQN8-pYw&e=
4. https://urldefense.proofpoint.com/v2/url?u=https-3A__archive.midrange.com_midrange-2Dl&d=DwICAg&c=jf_iaSHvJObTbx-siA1ZOg&r=2aXRESXNvBGuLbIQEybCPNLc7OK0UqjwsZsoCq7Jz6o&m=IQkB_ReAG5naSNPIsC_TWeMrlB6fgq7yejlo4lkVEok&s=u4sAYhCik2aZPMxd7Xn_4MCSXCpQKEjsON-Qwnh9sZY&e=
5. https://urldefense.proofpoint.com/v2/url?u=http-3A__amzn.to_2dEadiD&d=DwICAg&c=jf_iaSHvJObTbx-siA1ZOg&r=2aXRESXNvBGuLbIQEybCPNLc7OK0UqjwsZsoCq7Jz6o&m=IQkB_ReAG5naSNPIsC_TWeMrlB6fgq7yejlo4lkVEok&s=vZJgxfhXYtZ-tzQOSn2LEiRcXYpNLYZIthPW_J_DJJU&e=

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.