static void Main(string[] args)
{
string str = "aaaa,bbbb,cccc,dddd,eeee";
string[] condititons = str.Split(',');
string ss = "select * from table where aa in (";
for(int i=0;i<condititons.Length;i++)
{
ss = ss+condititons[i]+",";
}
//sql.Substring(0,sql.Length-1);
//ss = ss.Substring(0,sql.Length-1);
ss = ss.Substring(0,ss.Length-1);
ss = ss +")";
Console.WriteLine(ss);
}
}
java
String[] strs = {"01", "02"}
String strTemp ="";
try {
for (int k = 0; k < strs.length; k++) {
strTemp += strs[k] + ",";
}
strTemp = strTemp.substring(0, strTemp.length() - 1); // 将最后一个逗号去掉
String sql = "select* from user_status_t wherestatus in (" + strTemp +")";