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



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,
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, and
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:


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

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.