Error 3932 Only an ET or null statement is legal after a DDL Statement.

I have in one query the following components:

1)  I have a Create Multiset Volatile Table with a data primary index and with commit preserve rows.  This finds out the max date in the table and saves it.  So it only has 1 date in the created table.

2)  I have two CTE's (Common Table Expressions)   One of the queries references the date in #1.

3)  One Select statement to bring back the recordset I need.

When I run this I get an error:

>[Error] Script lines: 1-139 ------------------------
[Teradata Database] [TeraJDBC 16.20.00.06] [Error 3932] [SQLState 25000] Only an ET or null statement is legal after a DDL Statement.

How can I perform everything in one query without getting an error?