We help IT Professionals succeed at work.
Get Started

SQL syntax help/error

14_east
14_east asked
on
220 Views
Last Modified: 2021-04-21
I hav a query which is throwing an error, and I cannot seem to get it cleared.  The query is attached, and the error is below:

[Error Executing Database Query. 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 'LEFT JOIN tbl_prdtcat_rel pc ON p.product_ID = pc.prdt_cat_rel_Product_ID WH' at line 3
The error occurred on line 36.]
 
<cfquery name="rsProductsSearch" datasource="#request.dsn#" username="#request.dsnUsername#" password="#request.dsnPassword#">
SELECT DISTINCT p.product_ID, p.product_Sort, p.product_Name, p.product_MerchantProductID
FROM 
	LEFT JOIN tbl_prdtcat_rel pc
	ON p.product_ID = pc.prdt_cat_rel_Product_ID 
WHERE 
	p.product_OnWeb = 1
	AND p.product_Archive = 0
	<cfif application.allowbackorders EQ 0>
		AND s.SKU_Stock > 0
	</cfif>
		AND pc.prdt_cat_rel_Cat_ID = <cfqueryparam cfsqltype="cf_sql_integer" value="#url.c#">
	AND s.SKU_ShowWeb = 1
	ORDER BY
		p.product_Sort, 
		p.product_Name
</cfquery>

Open in new window

Comment
Watch Question
Senior Developer
CERTIFIED EXPERT
Commented:
This problem has been solved!
Unlock 1 Answer and 7 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE