Navigator > Setup > SQL Query Builder > SQL for Script tab
See also SQL Query Builder.
The SQL Query is formatted as a string suitable to pass as the Query parameter to the ExecuteSQL function in a MaxBasic script. You can cut and paste text in the window.