• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

merging result sets

 
Ranch Hand
Posts: 452
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Friends i have a problem:
I have to retrieve data from two tables each table contains two fields(for simplicity otherwise there are more) ie date and name. I have to merge the data from two result set and display the data sorted in order of date.
Like this

As you can see it is possible that a table may not contain any entry for particular tdate in that case that field should be left blank.
Any suggestions.
[ December 02, 2002: Message edited by: Prakash Dwivedi ]
 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Write a single query joining the two tables, and do an outer join for the fields that can be null.
Once, you get the result set, check for it being NULL , by using the method ResultSet.wasNull(), after retreiving the value:
String lStrTemp=ResultSet.getString(ColumnName);
if(ResultSet.wasNull())
lStrTemp=null;
reply
    Bookmark Topic Watch Topic
  • New Topic