When I try to use this select statement:
SELECT main.title, main.URL, main.description, main.city FROM main ORDER BY city WHERE (((main.active)=True));
I get a: Syntax error (missing operator) in query expression 'city WHERE (((main.active)=True))'
But, if I try this:
SELECT main.title, main.URL, main.description, main.city FROM main WHERE (((main.active)=True));
or this:
SELECT main.title, main.URL, main.description, main.city FROM main ORDER BY city;
They both work as expected. How do I combine them effectively?
Also, when I try the select statement below:
SELECT main.title, main.url, main.description, main.city
FROM main
WHERE (((main.category)="educ") AND ((main.category_2)="elem") AND ((main.active)=True));
I get a: Unterminated string constant Error (probably because of the double quotes?)
So how can this one be formatted to work without the quotes? (I have tried just removing them to no avail)
Thank You for your help. I am very happy to have found this resource (even though I couldn't find a thread with a solution to a similar problem)for your first problem, ORDER BY must follow WHERE
for your second problem the string delimiter is the single quote, not the double quote|||Originally posted by r937
for your first problem, ORDER BY must follow WHERE
for your second problem the string delimiter is the single quote, not the double quote
Thank you, first problem solved (Order of operations did the trick)
However, the second problem remains:
rs.Open "SELECT main.title, main.url, main.description, main.city
FROM main
WHERE (((main.category_2)='elem'));", conn%>
When you said the string delimiter is the single quote, I am assuming that means to bracket the elem by single quotes instead of double. The above select statement still gives me a Unterminated string constant error.|||have a look at this: Getting Your Quotes Right In SQL For ASP (http://www.webdevelopersjournal.com/articles/quotes_sql_asp.html)|||Could this be because you are using VBScript which requires end of line continuation markers something more like this? :-
rs.Open "SELECT main.title, main.url, main.description, main.city" _
& " FROM main" _
& " WHERE (((main.category_2)='elem'));", conn%>
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment