Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

ResultSet Concatenation?

Posted on 2002-03-28
7
Medium Priority
?
407 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Build and deliver software with DevOps

A digital transformation requires faster time to market, shorter software development lifecycles, and the ability to adapt rapidly to changing customer demands. DevOps provides the solution.

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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

704 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