Hello Thr. I know I am doing it correctly but, missing some very minor thing. I have a form whr I have 5 drop down lists and searching th ose values from a database. I already have entered some values in my database. When I try to run this below mentioned sql query with just one subskill, it runs fine. But when I run it with multiple subskills, it doesnt come up with any result. It says no record found. Please help me.
Below mentioned is my sql query.
Below mentioned is my sql query.
Code:
t1=request("skill") t2=request("subskill") t4=request("simple") t5=request("medium") t6=request("complex") if t1 <> "" and t2 <> "" and t4 <> "" and t5 <> "" and t6 <> "" then If InStr(t2,",") > 0 Then arrTerms = Split(t2,",") For x = 0 to UBound(arrTerms) login = "(select TOP "&t4&" * from skills where dept Like '%"&t1&"%' and desg Like '%"&arrTerms(x)&"%' and rating='simple')" 'login = login & "UNION (select TOP "&t5&" * from skills where dept Like '%"&t1&"%' and desg Like '%"&arrTerms(x)&"%' and rating='medium')" 'login = login & "UNION (select TOP "&t6&" * from skills where dept Like '%"&t1&"%' and desg Like '%"&arrTerms(x)&"%' and rating='complex')" If x < UBound(arrTerms) Then login = login & " AND " End If Next 'x 'login = login & " ORDER BY rating ASC;" else login="(select TOP "&t4&" * from skills where dept Like '%"&t1&"%' and desg Like '%"&t2&"%' and rating='simple' ORDER BY Rnd(Len([question]))) UNION (select TOP "&t5&" * from skills where dept Like '%"&t1&"%' and desg Like '%"&t2&"%' and rating='medium' ORDER BY Rnd(Len([question]))) UNION (select TOP "&t6&" * from skills where dept Like '%"&t1&"%' and desg Like '%"&t2&"%' and rating='complex' ORDER BY Rnd(Len([question])))" End If End If
Comment