Subject RE: [firebird-support] One query either of the two WHERE clause
Author Svein Erling Tysvær
>Token unknown - line 5, column 1
>TMP2

Sorry, CTEs should be separated with a comma (and you don't need to cast if using constants, only if using parameters):

WITH TMP1 (CBK, INO) AS
(SELECT 'A', 2 FROM RDB$DATABASE),
TMP2 (dValueFrom, dValueTo) ...

HTH,
Set