查询:
"SELECT COUNT(ID)AS 'COUNT(ID) from tbl_Leads WHERE UserID={Current User}"
修改:
if (Query.IndexOf("WHERE") > 0) {
if (Query.Contains("UserID = {CurrentUser}")) {
Query = Query.Replace("UserID = {CurrentUser}", "UserID IN (" + UserIDs + ")");
if (dropdownValue != 0) {
Query += "";
Query+= "AND FKiLeadClassID="+dropdownValue;
}
}
if (Query.Contains("OrganizationID = {CurrentUser}")) {
Query = Query.Replace("OrganizationID = {CurrentUser}", "OrganizationID=" + OrganizationID);
if (dropdownValue != 0) {
Query += "";
Query += "AND FKiLeadClassID=";
Query += dropdownValue;
}
}
}
else if(Query.IndexOf("WHERE") == 0) {
if (dropdownValue != 0) {
Query += " Where";
Query += " FKiLeadClassID=";
Query += dropdownValue;
}
}
需要:请考虑" GROUPBY"和" ORDERBY"条款也是如此。
我想:
"SELECT COUNT(ID)AS 'COUNT(ID) from tbl_Leads WHERE UserID IN (234) AND FKiLeadClassID=43"
(如果没有groupby或orderby)
OR
我想:
"SELECT COUNT(ID)AS 'COUNT(ID) from tbl_Leads WHERE UserID IN (234) AND FKiLeadClassID=43" GROUPBY(something) ORDERBY(something).