Solved

ResultSet Concatenation?

Posted on 2002-03-28
7
392 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
base64 decode encode 12 122
Error with Java/Cache JDBC Classpath 2 31
Cipher Configuration on Apache HTTPD 4 53
Arrays.asList  VS  ArrayList 4 45
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…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

863 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

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now