Trevor has a nice one, but if it gets more complex, you probably need to do more k# scripting.
The idea is to get general WHERE condition so if you have ?tagId=Car,Phone&year=2016,2017
it should translate into SQL WHERE TagID IN ('Car','Phone') AND Year IN (2016,2017)
{%
sqlWhere ="";
cond1 = string.IsNullOrEmpty(QueryString["TagID"]) ? "" : "'" + Replace(QueryString["TagID"], ",", "','") + "'";
cond1 = string.IsNullOrEmpty(cond1)? "" : "TagID in (" + cond1 + ")";
cond2 = string.IsNullOrEmpty(QueryString["Year"]) ? "" : " Year IN (" + QueryString["Year"] + ")";
if (cond1 !="" && cond2 !="") {
sqlWhere = cond1 + " AND " + cond2
}
else {
sqlWHere = (cond1 == "" ? cond2 : cond1);
}
return sqlWHere
|(handlesqlinjection)false|(identity)GlobalAdministrator%}
P.S. You need to add handlesqlinjection in order to make you quotes work