Click to See Complete Forum and Search --> : SQL Statement problem


ncozzolino
10-20-2004, 11:48 AM
There is something wrong with this statement and I can't figure it out. All the values are getting passed. Any idea?


strSQL = "SELECT * FROM qaTable WHERE qaDepartment='"& curdepsearch &"' WHERE qaQuestion LIKE '%" & curSearch & "%' ORDER by qaQuestion"


I get error messages:

Microsoft JET Database Engine (0x80040E14)
Syntax error (missing operator) in query expression 'qaDepartment='AA' WHERE qaQuestion LIKE '%test%''.
/drintranet/qasearch.asp, line 21

Jona
10-20-2004, 12:08 PM
I think you're missing the keyword "OR."


strSQL = "SELECT * FROM qaTable WHERE qaDepartment='"& curdepsearch &"' OR WHERE qaQuestion LIKE '%" & curSearch & "%' ORDER by qaQuestion"

schizo
10-20-2004, 12:13 PM
There should be no second WHERE either...


strSQL = "SELECT * FROM qaTable WHERE qaDepartment='"& curdepsearch &"' OR qaQuestion LIKE '%" & curSearch & "%' ORDER by qaQuestion"