Click Data --> Report Query. The Following window will appear
Type the SQL Query you want. To pass Parameters user $P{PARAMENTER_NAME} (in iReport 2.0 or higher). You can click the “Automatically Retrieve Fields” check box to retrieve the fields.
Keep in mind if there’s an SQL error the fields will not be retrieved and the SQL error will be displayed.
You can also select the fields you want from a Database Model and generate the Query automatically. I DO NOT recommend this. Although you can set the conditions before hand I always find it reliable when I have a working Query in my hands. It’s always better to know that the query works. So create the query using SQL Navigator or a similar tool using sample data for “Parameters” and use that query.
Click OK after Fields are retrieved.