Where are you mapping your sub report parameteres with query result field ?
you are running query in main report so when you are adding subreport, you need to add these parameters from parent report and need to map with query result.
if you are using ireport,
1. when you will run query , the result will be there in fields.
2. When you will add subreport, do right click on subreport icon in parent report and go to add parameters for subreport. Click add parameter and assign values from field.