Jump to content
JasperReports Library 7.0 is now available ×

Problem in giving multiplequeries!


Recommended Posts

By: Anuradha - anura

Problem in giving multiplequeries!

2003-08-19 02:25

Hello...

I'm creating a new report and that report reads FIELDNAMES from "Table1" and reads another FIELDNAME called "SYSDATE" from the table "DUAL".

I've created a textfield for SYSDATE where the TextFieldExpression is "$F{SYSDATE}" of

Expression class "java.sql.Timestamp".

I've READ & REGISTERED the fields for both the tables which is present in the VALUES FORM.

During compilation, i face the problem of giving MULTIPLE QUERIES(say, select * from table1 and select SYSDATE from dual etc..) which gives me COMPILATION ERROR saying

"java.sql.SQLException: Invalid column name" !

 

and 'am not able to get the output which gives me the current "SYSDATE" along with that....

Cud u plzz help me in this regard..?

 

Thanx...!

 

 

 

 

 

 

By: Ryan Johnson - delscovich

RE: Problem in giving multiplequeries!

2003-08-19 09:33

Try select table1.*, dual.SYSDATE from table1, dual...

 

Ryan

 

 

 

 

By: Sohan Kasula - skasula

RE: Problem in giving multiplequeries!

2003-08-19 12:15

If the columns are from table1 and sysdate from dual table then UNION has to be used to get combined result set.

 

e.g select column1 from table1

UNION

select sysdate column1 from dual

 

notice the alias column1 on sysdate to match the column names to first query. Not only the column names, datatypes should also match. With the above example you'll get a separate record for dual table all the time.

 

Alternative approach is to list all the columns of table1 instead of a * and also list sysdate.

 

e.g select column1, coulmn2, ....,sysdate from table1.

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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...