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