Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

What is wrong with this WHERE statement?

Guest
Oct 18, 2009 Oct 18, 2009

What is the problem with this WHERE statement?

<cfquery datasource="manna_premier" name="kit_report">
SELECT SaleDate,
       TerritoryManager,
    Distributor,
    DealerID,
    Variable,
    US_Dealers.ID,
       DealerName,
    DealerAddress,
    DealerCity,
    DealerState,
    DealerZIPCode   
FROM Orders, US_Dealers
WHERE US_Dealers.ID EQ DealerID AND SaleDate BETWEEN #CreateODBCDate(FORM.Start)# AND #CreateODBCDate(FORM.End)#
ORDER BY SaleDate
</cfquery>

This is driving me nuts!!!!!

701
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Valorous Hero , Oct 18, 2009 Oct 18, 2009

Syntax error (missing operator) in query expression 'US_Dealers.ID EQ DealerID

You are accidentally using the CF equals operator:  "EQ"

Instead of the one for MS Access:   "="

[Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Microsoft Access Driver] ...

in query expression ... AND SaleDate BETWEEN #10/1/2009# AND #10/18/2009#'.

I do not see how CreateODBCDate() would produce those values.  But perhaps it is just a quirk of the error message?

Translate
Valorous Hero ,
Oct 18, 2009 Oct 18, 2009

What is the problem with this WHERE statement?

What is the full error message ?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Oct 18, 2009 Oct 18, 2009

Error Executing Database Query.

[Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'US_Dealers.ID EQ DealerID AND SaleDate BETWEEN #10/1/2009# AND #10/18/2009#'.
The error occurred in D:\Inetpub\mannapremier\kit_report2.cfm: line 15
13 :         DealerZIPCode        
14 : FROM Orders, US_Dealers
15 : WHERE US_Dealers.ID EQ DealerID AND SaleDate BETWEEN #CreateODBCDate(FORM.Start)# AND #CreateODBCDate(FORM.End)#
16 : ORDER BY SaleDate
17 : </cfquery>
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Oct 18, 2009 Oct 18, 2009

Syntax error (missing operator) in query expression 'US_Dealers.ID EQ DealerID

You are accidentally using the CF equals operator:  "EQ"

Instead of the one for MS Access:   "="

[Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Microsoft Access Driver] ...

in query expression ... AND SaleDate BETWEEN #10/1/2009# AND #10/18/2009#'.

I do not see how CreateODBCDate() would produce those values.  But perhaps it is just a quirk of the error message?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Oct 18, 2009 Oct 18, 2009

I'm guessing that the CreateODBCDate() isn't producing that output because the template hasn't processed yet. You were right about the EQ, saved me from pulling out the rest of my hair. Thank you! Again!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Oct 18, 2009 Oct 18, 2009
LATEST

emartek1 wrote:

I'm guessing that the CreateODBCDate() isn't producing that output because the template hasn't processed yet. You were right about the EQ, saved me from pulling out the rest of my hair. Thank you! Again!

Actually it has or you would not be seeing a database driver error.  But I am glad it is working now!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources