To create the SQL directly, you can go to database->database expert->your datasource->add command and enter the SQL there.
You can copy the "show SQL query" formula into a command in a new report, if you wish.
PS. You are in the wrong forum. Try forum149 or forum767 in the future for similar questions.
-LB