removing comma from string array

Posted by sarah on Stack Overflow See other posts from Stack Overflow or by sarah
Published on 2010-06-09T06:19:17Z Indexed on 2010/06/09 6:22 UTC
Read the original article Hit count: 133

Filed under:
|

Hi,

I want to execute a query like select ID from "xyz_DB"."test" where user in ('a','b')

so the corresponding code is like

String s="(";
    for(String user:selUsers){
        s+= " ' " + user + " ', ";
    }
    s+=")";

Select ID from test where userId in s;

The following code is forming the value of s as ('a','b',) i want to remove the comma after the end of array how to do this ?

© Stack Overflow or respective owner

Related posts about java

Related posts about sql