|
SQL Syntax for Like
Hey everyone!
This is probably a realy easy fix that I'm overlooking. I always mess up the syntax for SQL.
I'm trying to do a like on a date field.
On one page I have the user select a month which is in a querystring. The next page takes the string and changes it slightly so I can compare it to a date field in my database. My code:
Month = QueryString("Month")
If Month = "1" Then
Month = "1%"
End If
I make it change to 1% because to do a like you add % after so it looks for everything that starts with 1.
sql = "SELECT select bunch of fields including date of publication WHERE [News-Clippings-Information].[Date of Publication] LIKE 'Month' "
Now this doesn't output anything....the Month variable does output 1% if I just call <%=Month%>
If I use the same statement above but replace 'Month' with '1%' it works fine. So I tried just Month...error...I tried "Month"....error...I tried a whole bunch more...still error.
I'm sure it's just a small stupid syntax error...but if someone could point it out I would much appreciate it!
|