Subject Re: [firebird-support] Annoying: CTE "CTE2" is not used in query
Author Tim Ward
This is even more annoying when the "large SQL with many CTEs" is generated from a large complex piece of code, and you've got to make sure that the large complex piece of code doesn't generate a CTE that doesn't happen to be used this time.

On 14/08/2015 15:00, 'Louis van Alphen' louis@... [firebird-support] wrote:
 

See the following SQL below.

If I select from COMBINED, the sql runs but as below I get an error. This is pretty annoying when constructing a large SQL with many CTEs and you want to test each one and combinations of them. I can get why the error is there, but any other suggestion?

 

with

CTE1 as

(

  select 1 as ID from rdb$database

),

CTE2 as

(

  select 2 as ID from rdb$database

),

 

COMBINED as

(

  select * from CTE1

    union

  select * from CTE2

)

 

select * from CTE1



-- 
Tim Ward