Solved

ResultSet Concatenation?

Posted on 2002-03-28
7
390 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
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
bitbucket vs gitbucket 3 32
Problem to start Neon 20 53
Java Server Faces parameter pass? 6 22
Java DateChooser? 2 11
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

758 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

19 Experts available now in Live!

Get 1:1 Help Now