I have two result sets (rs1 and rs2) having same fields. Now how to combine those two result sets into one so that duplicate rows are shown once.
I have two result sets ( rs1 and rs2 ) having same fields. Now
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
if the two
ResultSets are from the same database then why not combine them during the retrieval by usingunion; e.g.However, if this is not an option then I suggest defining a
Rowclass to represent a Row extracted from yourResultSetand implementingequals/hashCodeto allow theRowto be compared for equality. Then simply add eachRowto aSet(e.g.HashSet) in order to remove duplicates.