ColdFusion Query Of query

1.9k views Asked by At

This query:

SELECT * FROM getlogs WHERE id > #id# AND logType = "login" LIMIT 1

Gives me this error:

Error Executing Database Query.


Query Of Queries syntax error.
Encountered "logType. Incorrect conditional expression, Incorrect conditional expression, Lexical error at line 0, column 0. Encountered: "\"" (34), after : ""
2

There are 2 answers

1
CF Guy On BEST ANSWER

Use max rows:

< cfquery dbType="query" name"myQ" maxrows="1">
SELECT * FROM getlogs WHERE id > #id# AND logType = "login"
< /cfquery>

6
Joel Coehoorn On

Use single quotes instead of double quotes.