java - Need to convert a Result Set to some data structure -


i have java.sql.resultset this:

============================= | cola | colb | colc | cold | ============================= |   1  |   1  |   1  |   1  | |   1  |   1  |   1  |   2  | |   1  |   1  |   2  |   3  | |   1  |   1  |   2  |   4  | |   1  |   2  |   3  |   5  | |   1  |   2  |   4  |   6  | |   1  |   2  |   4  |   7  | |   1  |   2  |   4  |   8  | |   1  |   3  |   5  |   9  | |   1  |   3  |   6  |  10  | ============================= 

the first column have single value. last column unique.

i need implementation want retrieve items in cold correspond specific item in colb or colc or cola.

for instance, if request items in cold value 2 in colb, should [5,6,7,8](as list or array).

i wondering if tree implementation right way go this.

what best way accomplish is? in advance.

select cold tablename colb='2'; 

isn't above query sufficient ?

update

if need done in java :

resultset rs=getalldatainresultset();//this method return stored procedure list<int> resultlist=new arraylist<>(); while(rs.next()){       int  colb=rs.getint(2);       if(colb==2){        resultlist.add(rs.getint(4));       } } logger.debug(resultlist); //logging final result list 

output :

[5,6,7,8] 

Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - Bypass Geo Redirect for specific directories -

php - .htaccess mod_rewrite for dynamic url which has domain names -