Encountered "(. Incorrect Select Statement, Expecting a 'FROM', But Encountered '(' Instead, A Select Statement Should Have a 'FROM' Construct.

Posted June 30, 2006 at 12:08 PM

Tags: ColdFusion, SQL

I was testing some ColdFusion Query of Queries functionality when I got this error:

Query Of Queries syntax error.
Encountered "(. Incorrect Select Statement, Expecting a 'FROM', But Encountered '(' Instead, A Select Statement Should Have a 'FROM' Construct.

I know what was causing the error because I was testing to see if something worked, but it's not the most obvious error. I guess it's a syntax error (from a technical standpoint), but in my case, where I was testing to see if ISNULL() worked, I'm really using a function that is not available.

That being said, if you get the error above, it means you are using something in the SELECT statement that is not allowed. If you are coming over from SQL, make sure you are not trying to use any SQL functions that are not available in the ColdFusion Query of Queries. As a foot note, here are some common SQL functions that I use that are not available in the ColdFusion Query of Queries:

ISNULL()
LEN()
DATEADD()

Comments (4)  |  Post Comment  |  Ask Ben  |  Permalink  |  Other Searches  |  Print Page




Reader Comments

Hrm...

In my case, I have an XML file which I'm converting into a query object. The resulting query has a column named date. I can select * just fine, but when I specify the date column it blows up. Leave that column out and it works just fine. I've tried bracketing the column name, quoting it bracketing AND quoting to no avail.

Anyone have any ideas?

Posted by Andy Matthews on Mar 31, 2007 at 11:25 PM


Okay...

In this case, the solution was ot both bracket AND alias the questionable column. So this works:

SELECT [date] AS thedate
FROM QofQ

Posted by Andy Matthews on Mar 31, 2007 at 11:43 PM


Exactly... in fact, the same thing would apply to a regular non-query-of-queries SQL statement.

Posted by Ben Nadel on Apr 1, 2007 at 9:37 AM


I've run into this error as well using the COUNT function. It only works when i have just the function in the SELECT list and use no alias which is worthless for my purposes.

Posted by Matt Foster on Oct 3, 2007 at 10:53 AM


Post Comment  |  Ask Ben


Home   |   Web Log   |   ColdFusion   |   Projects   |   Resume   |   Job Form   |   Search   |   Contact
Epicenter Consulting - Custom Software Solutions for Business Evolution HostMySite.com - The Leader In ColdFusion Hosting