I have a bunch of queries that is stored in a file provided by a vendor and I know that it always returns rows with 2 columns in them. For eg:
Code:
SELECT EMPID, NAME FROM EMPLOYEE;
SELECT BOOK_ID, BOOKNAME FROM BOOKS;
However I cannot modify them in anyway.
I want to use these statements in a generic sql statement like 'SELECT col2 from (vendor-sql-statement)' to access values in column 2. For eg:
Code:
-- Get all the employee names without the employee ids:
select [col2] from (SELECT EMPID, NAME FROM EMPLOYEE)
-- Get all the book names without the book ids:
select [col2] from (SELECT BOOK_ID, BOOKNAME FROM BOOKS)
Is there a way of accessing doing this in DB2?