Solved

ResultSet Concatenation?

Posted on 2002-03-28
7
397 Views
Last Modified: 2008-03-03
The $epoch_starttime and $epoch_endtime in the following query are variables.  I need to generate a ResultSet object from each of the following tables and add the results together into one ResultSet object.  

The reason for this is I am working with a third party software and they can only accept one recordset object for processing(charting software).  Is it possible to concatenate results from one ResultSet object onto another?  If not, how could I go about addressing this problem?

Tables
m2002_01, m2002_02, m2003_03

Query Example
Select Server as Server_name, Browser as Browser_name where starttime > $epoch_starttime and endtime < $epoch_endtime.  
0
Comment
Question by:jerrykovach
7 Comments
 
LVL 9

Expert Comment

by:Venci75
ID: 6903160
Select Server as Server_name, Browser as Browser_name
from m2002_01
where starttime > $epoch_starttime and endtime < $epoch_endtime

union

Select Server as Server_name, Browser as Browser_name
from m2002_02
where starttime > $epoch_starttime and endtime < $epoch_endtime

union

Select Server as Server_name, Browser as Browser_name
from m2002_03
where starttime > $epoch_starttime and endtime < $epoch_endtime


...
0
 

Author Comment

by:jerrykovach
ID: 6903255
I wish this solution would work but mySQL doesn't support the union command.  
0
 
LVL 5

Expert Comment

by:kelfink
ID: 6903455
If you can upgrade to mySQL 4.0.0, then it has been implemented.

http://www.mysql.com/doc/U/N/UNION.html

If not, then I recommend a temporary table...

Use:

create temporary table temp_m2002
 ( server_name varchar(20), browser_name varchar(20));

insert into temp_m2002 ( server_name, browser_name)
select server as server_name , browser as browser_name
from m2002_01 where starttime > $epoch_starttime and endtime
< $epoch_endtime;

insert into temp_m2002 ( server_name, browser_name)
select server as server_name , browser as browser_name
from m2002_02 where starttime > $epoch_starttime and endtime
< $epoch_endtime;

insert into temp_m2002 ( server_name, browser_name)
select server as server_name , browser as browser_name
from m2002_03 where starttime > $epoch_starttime and endtime
< $epoch_endtime;

select * from temp_m2002 ;

The select will return the one big result set, containing all selected rows.  When the session is closed, the temporary table will drop automatically.
0
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 
LVL 1

Expert Comment

by:Moondancer
ID: 6912965
Has this helped you or is more needed?
Moondancer - EE Moderator
0
 

Accepted Solution

by:
pothuganti_srinivas earned 200 total points
ID: 7073109
One approach is to have a disconnected result set(your own implementation of IResultSet)which has a method to merge the 2 resultsets. For a implementation of ResultSet check  - http://developer.java.sun.com/developer/technicalArticles/javaserverpages/cachedrowset/

0
 
LVL 1

Expert Comment

by:Moondancer
ID: 7073158
jerrykovach ->  You last logged in May, 2002, after my request above was posted, and additional information has been added by another expert.  Please update and finalize this question.

If no response, expert input please with closing recommendations for me.

Thanks,

Moondancer - EE Moderator
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 7082225
Zero response, finalized by Moondancer - EE Moderator
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Maven Project: Hibernate Dependencies Conflict 10 38
throw exception 21 58
collection output issue 9 36
Need Help! Getting a syntax error and don't understand why 3 31
For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
This video teaches viewers about errors in exception handling.

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question