Jump to content
We've recently updated our Privacy Statement, available here ×

second sql query


babarincairo

Recommended Posts

Hi,

 

I made a report containing an input parameter (named numeroId).

 

I made my main query without problem to display data in the detail band. Example : SELECT C1,C2 FROM T1 WHERE C3 = $P{numeroId}

 

After that, in the title band , I want display an item

corresponding to a field of the line identified by numeroId. It means, do a query like this :

SELECT C4 FROM T2 WHERE numeroId = $P{numeroId}

 

But, I don't know where to put this query. I tried to use a subdataset but I don't know how to use the result field.

 

Can you help me ?

 

thanks

Link to comment
Share on other sites

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

You could solve the problem with 2 solutions:

1) you could make a query in which you put all the information you need:

 

select c1,c2,c4 from t1,t2

where

.......

 

Then you have the field C4 at your disposal and you could put the field in the title.

 

2) make a subreport.

 

Let us know if this help.

 

Bye

Dpinfo

Link to comment
Share on other sites

dpinfo wrote:

1) you could make a query in which you put all the information you need:

select c1,c2,c4 from t1,t2
where
.......

Then you have the field C4 at your disposal and you could put the field in the title.

 

 

Ok, but it must be the main data source ?? Because I can't create a field or a variable with the SQL query as expression. It does'nt compile

Link to comment
Share on other sites

From my point of view, in the main query you need to make a merge of the queries. From my point of view it seems possible.

If you don't like this solution you could create a subreport. With this solution you put the second query in the data/query of the second report, with a parameter . In the subreport properties in the master report in subreport(others) you need to define to which field of the master report the parameter is linked.

Bye

dpinfo

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...