| Author |
Remove duplicate value from resultset
|
khamhielle gabriel
Greenhorn
Joined: Aug 15, 2011
Posts: 16
|
|
Hi,
can somebody give me a hand on this:
i was trying to avoid printing duplicate data from the database
where in whenever i call from the database, most of the other values are just reprinted because there is one unique value.
what i need to do is to just print only what is unique on its given group.
Example of repeated values:
1234av Casie 5678
1234aw Shel 5762
1234aw Shel 0998
1234ax nica 9754
needed output :
1234av Casie 5678
1234aw Shel 5762 0998 ---* the unique value should be printed at the side rather than creating the whole set of line again.
1234ax nica 9754
sorry i'm really poor on loops please help me. thanks
and God Bless
ps: i was printing it on a text file
|
 |
Gerald Lam
Greenhorn
Joined: Aug 23, 2010
Posts: 6
|
|
Hm, I'm not sure if there's a better way to do it, but in my opinion, you could use a Map to store the values, so and check if there's a duplicate, if there is, get the value and append the new value to it.
For the key, you could combine both, for example, from the code you've given, 1234aw,Shel. And if you need to use the key, just split it with ",".
|
 |
 |
|
|
subject: Remove duplicate value from resultset
|
|
|