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



Since the TABLE names in the FROM clause would presumably have to be /hard coded/, then why not also the literal in each SELECT to represent those TABLE names? Or if the file names are variables, then presumably a prepared statement is being used, so the variable can be used to concatenate as both the literal expressions on the SELECT list *and* the file names in the respective FROM clauses?

Or perhaps the TABLE names specified on the FROM clauses are just /labels/ [hard coded] that are overridden at run-time to the actual file & library name? If so, then there is apparently an algorithm for generating the TOFILE() names; i.e. if at run-time the query can refer to the new files without changing the query, then by the same method, so should the values in the SELECT column\expression list be capable of change. Just use the same algorithm to generate the name for both of the TABLE names and both of the literals; e.g. create a UDF that utilizes that same algorithm [or less desirable but similarly functional, retrieve the TOFILE() value from the overrides using the Retrieve File Override Information (QDMRTVFO) API].?

Regards, Chuck

David FOXWELL wrote:

I'm running a complicated query on two tables with UNION all and I'd like the table names to show up in the result to compare
them. Is it possible to have the name of the table show up in a
select? I don't want to hard code the name as I must save this
query for use in a year's time. The table names change each
year.


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.