× 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.



That gave me the same results, sorted by ID.


date: Mon, 29 Aug 2022 19:47:09 +0000
from: Darren Strong <darren@xxxxxxxxx>
subject: RE: Sort JSON_OBJECTAGG

Sorry. I read it wrong. That didn't work at all, did it?

-----Original Message-----
From: Darren Strong
Sent: Monday, August 29, 2022 3:46 PM
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxxxxxxxx>
Subject: RE: Sort JSON_OBJECTAGG

This worked for me on a test file. You basically pre-sort the file you're
reading from, rather than reading direct from the file:

select cast(
json_objectAgg(trim(cast(ID as char(6))) value trim(DESC)
ABSENT ON NULL) as varchar(500))
from (select * from qtemp/tstfil order by desc)


Results:
CAST function
{"1":"TEST 1","2":"TEST 5","3":"TEST 2"}



As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.