EasyCFM.COM ColdFusion Forums / Coding Help! / #1064 - You have an error in your SQL syntax

   Reply to Discussion | New Discussion << previous || next >> 
Posted By Discussion Topic: #1064 - You have an error in your SQL syntax

book mark this topic Printer-friendly Version  send this discussion to a friend  new posts last

ukotukot
08-25-2004 @ 4:39 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 5
Joined: Aug 2004

I run this cold fusion query on a mysql database that i have,
<cfquery name="GetAllAccts" datasource="#MyConnectionString#" dbtype="mysql">
SELECT *
FROM Accounts, Customers
Where Accounts.customer_id=Customers.customer_id
AND Customers.customer_id=#session.custid#
AND Accounts.account_id=#session.accid#
</cfquery>

and i get this error.

Error

SQL-query :

SELECT *
FROM Accounts, Customers
WHERE Accounts.customer_id = Customers.customer_id AND Customers.customer_id = AND Accounts.account_id =
LIMIT 0 , 30

MySQL said:


#1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND Accounts.account_id = LIMIT 0, 30' at line 3

How do i restructure the query so that it will work with mysql cos it works just fine if i use access
Thanks in anticipation
Regards

IdefiX
08-25-2004 @ 5:17 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Junior Member
Posts: 92
Joined: Mar 2003

[...]Where Accounts.customer_id=#Customers.customer_id#
[...]

you didn't put the ## thinghys Wink  (brackets???)
------------------------------
I'm sick of all you hypocrites holding me at bay And I don't need your sympathy to get me through the day.
A Change Of Seasons.

http://www.chilebike.cl

This message was edited by IdefiX on 8-25-04 @ 5:18 PM


Website Designed and Developed by Pablo Varando.