Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 175
  • Last Modified:

Error in my FROM Statement but dont know where ??

Hi all,

can someone run their eyes over this. i'm getting the following error message:

Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Microsoft Access Driver] Syntax error in FROM clause.  
 
The error occurred in C:\Inetpub\wwwroot\woodbits\index.cfm: line 1
 
1 : <cfquery name="GetRecProducts" datasource="#request.dsn#" username="#request.dsn#" password="#request.dsn#">
2 : SELECT tbl_prdtcategories.category_ID, tbl_products.product_Name,
3 : tbl_products.product_Description, tbl_products.product_Archive,
 

the code is :

<cfquery name="GetRecProducts" datasource="#request.dsn#" username="#request.dsn#" password="#request.dsn#">
SELECT tbl_prdtcategories.category_ID, tbl_products.product_Name, 
tbl_products.product_Description, tbl_products.product_Archive, 
tbl_prdtimages.prdctImage_FileName
FROM tbl_products
INNER JOIN tbl_prdtcategories
INNER JOIN tbl_prdtcat_rel ON
tbl_prdtcategories.category_ID = tbl_prdtcat_rel.prdt_cat_rel_Cat_ID ON
tbl_products.product_ID = tbl_prdtcat_rel.prdt_cat_rel_Product_ID
INNER JOIN tbl_prdtimages ON
tbl_products.product_ID = tbl_prdtimages.prdctImage_ProductID
WHERE tbl_prdtcategories.category_ID=6
AND tbl_products.product_Archive=0
</cfquery>

Open in new window

0
bede123
Asked:
bede123
  • 2
  • 2
1 Solution
 
Daniel ReynoldsSoftware Applications Developer / IntegratorCommented:
you are missing the ON statement condition for the first inner join
FROM tbl_products
INNER JOIN tbl_prdtcategories   <ON   blah>
0
 
bede123Author Commented:
thanks. i dont suppose you can help me some more. this code was written for me so i'm really not sure what exactly should go after the ON


INNER JOIN tbl_prdtcategories

0
 
Daniel ReynoldsSoftware Applications Developer / IntegratorCommented:
I have modified the query a bit and moved some join info around.

This should be what the author intended.

SELECT tbl_prdtcategories.category_ID
    , tbl_products.product_Name
    , tbl_products.product_Description
    , tbl_products.product_Archive
    , tbl_prdtimages.prdctImage_FileName
FROM tbl_products
INNER JOIN tbl_prdtcategories ON tbl_prdtcategories.category_ID = tbl_prdtcat_rel.prdt_cat_rel_Cat_ID
INNER JOIN tbl_prdtcat_rel ON tbl_products.product_ID = tbl_prdtcat_rel.prdt_cat_rel_Product_ID
INNER JOIN tbl_prdtimages ON tbl_products.product_ID = tbl_prdtimages.prdctImage_ProductID
WHERE tbl_prdtcategories.category_ID=6
AND tbl_products.product_Archive=0


0
 
bede123Author Commented:
great. thank you very much indeed.
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now