|
Here's a very dumb option off the top of my head:
with T1 as (select A, B, ..., Z from ...)
select count(*), '' as A, 0 as B, ..., ' ' as Z from T1
union 0, A, B, ..., Z from T1
The first line creates your CTE. The second line creates a count record
where the first field is the count and all the other fields are blank or
zero, the third line brings in all the records from the CTE but with 0
in the count field.
Short of a temporary table, that's the best I can come up with, and it
doesn't address doing a bunch of other subselects on that data. For
that, I definitely think you need a temporary table.
On 7/28/2020 7:52 AM, Maria Lucia Stoppa wrote:
@Vernon,and
I didn't attach any example because it's really complex, but you got it
right.
As you stated, select statements can't return more than one result, so I
was wondering if it's possible to use a CET to serve multiple selects,
it seems it's not.
Yes, the many selects that run have the same from clause and where clause
(built with host variables as you imagined), that's why I hoped I missed
some tricks or ways to do things.
Thank you
Il giorno mar 28 lug 2020 alle ore 14:34 Vernon Hamberg <
vhamberg@xxxxxxxxxxxxxxx> ha scritto:
--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.
Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com
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.