java - Problems with (PreparedStatement prest) in retrieving data from the database -


        query="select friend_uname myfriends";//select friends of user         system.out.println(query);         rs=stmt.executequery(query);               query="select * service_provider source=\""+source+"\" , dest=\""+dest+"\"    , resources>0 , provider_name in(?);";         system.out.println(query);         prest=conn.preparestatement(query);          while(rs.next())         {         x=rs.getstring("friend_uname");//select friend names of user 1 one...         system.out.println("the friend_uname is"+ x);         prest.setstring(1,x);//set ith position of string friend name         } 

try query

query="select * service_provider source=\""+source+"\" , dest=\""+dest+"\"  , resources>0 , provider_name in(select friend_uname myfriends)"; 

or try join query

query="select sp.* service_provider sp, myfriends myfrnd sp.source=\""+source+"\" , sp.dest=\""+dest+"\"  , sp.resources>0 , sp.provider_name=myfrnd.friend_uname"; 

Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -