Solved

Need help with SQL Select statement

Posted on 2014-01-11
3
552 Views
Last Modified: 2014-01-11
I created a select statement that displays fine when querying all records in my ColdFusion web page. When I input criteria in my search page I received an error.

I am using ColdFusion with MS Access.

Select Statement: (works fine with out any criteria inputted in the search)
SELECT *

FROM TBL_SHIP INNER JOIN (TBL_PROJECTS RIGHT JOIN TBL_DWG ON TBL_PROJECTS.PR_ID = TBL_DWG.DW_PROJECTID) ON TBL_SHIP.SH_ID = TBL_DWG.DW_SHIPID

Error received when inputting critera:
Error Executing Database Query.
[Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Microsoft Access Driver] JOIN expression not supported.
SQLSTATE         HY000
SQL          SELECT * FROM TBL_SHIP INNER JOIN (TBL_PROJECTS RIGHT JOIN TBL_DWG ON TBL_PROJECTS.PR_ID = TBL_DWG.DW_PROJECTID) ON TBL_SHIP.SH_ID = TBL_DWG.DW_SHIPID AND SH_HULL = 'YC' ORDER BY DW_GROUP  
0
Comment
Question by:DJPr0
  • 2
3 Comments
 
LVL 57

Accepted Solution

by:
Jim Dettman (Microsoft MVP/ EE MVE) earned 500 total points
ID: 39773440
Your missing the verb WHERE in your SQL statement:

SELECT * FROM TBL_SHIP INNER JOIN (TBL_PROJECTS RIGHT JOIN TBL_DWG ON TBL_PROJECTS.PR_ID = TBL_DWG.DW_PROJECTID) ON TBL_SHIP.SH_ID = TBL_DWG.DW_SHIPID WHERE SH_HULL = 'YC' ORDER BY DW_GROUP  

Jim.
0
 

Author Comment

by:DJPr0
ID: 39773449
Thanks Jim - this seems to work:
SELECT *

FROM TBL_SHIP INNER JOIN (TBL_PROJECTS RIGHT JOIN TBL_DWG ON TBL_PROJECTS.PR_ID = TBL_DWG.DW_PROJECTID) ON TBL_SHIP.SH_ID = TBL_DWG.DW_SHIPID

Where 1=1

Not sure why I need 1=1 for the where to work
0
 

Author Closing Comment

by:DJPr0
ID: 39773643
Thx Jim.
0

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
I have a large data set and a SSIS package. How can I load this file in multi threading?
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Viewers will learn how the fundamental information of how to create a table.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now