Solved

Need help with SQL Select statement

Posted on 2014-01-11
3
549 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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Sometimes databases have MILLIONS of records and we need a way to quickly query that table to return the results me need. Sure you could use CFQUERY but it takes too long when there are millions of records. That is why SOLR was invented. Please …
Confronted with some SQL you don't know can be a daunting task. It can be even more daunting if that SQL carries some of the old secret codes used in the Ye Olde query syntax, such as: (+)     as used in Oracle;     *=     =*    as used in Sybase …
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

746 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

13 Experts available now in Live!

Get 1:1 Help Now