Skip to main content
Solved

inline querier not finding column


tva
Contributor
Forum|alt.badge.img+12
  • Contributor
Hi,

 

 

I'm using the inline querier to execute a sql statement but only if a certain condition is met (defined by tester).

 

 

I created my sql statement in MS Access and there it's working fine but when I use the same statement in the inline querier I get following error message:

 

 

ERROR |InlineQuerier_3(InlineQueryFactory): Error preparing database query: no such column: stop_times.trip_id Unable to execute statement

 

ERROR |InlineQuerier_3(InlineQueryFactory): Database was unable to prepare query 'SELECT *

 

FROM (route_max INNER JOIN (stop_times INNER JOIN stops ON stop_times.stop_id = stops.stop_id) ON route_max.trip_id = stop_times.trip_id) INNER JOIN (routes INNER JOIN Trips ON routes.route_id = Trips.route_id) ON route_max.trip_id = Trips.trip_id;

 

ERROR |InlineQueryFactory instance was not properly defined. Consult logfile for details.

 

 

This is the SQL statement I use:

 

SELECT *

 

FROM (route_max INNER JOIN (stop_times INNER JOIN stops ON stop_times.stop_id = stops.stop_id) ON route_max.trip_id = stop_times.trip_id) INNER JOIN (routes INNER JOIN Trips ON routes.route_id = Trips.route_id) ON route_max.trip_id = Trips.trip_id;

 

 

For information about tables and columns see attached screenshot

 

 

What should I change in order to this to work?

 

 

My SQL knowledge isn't that great so what I do in the workbench is:

 

 

Run a first inline querier (this one succeeds with 4 outputs)

 

 

1 output = route_max (SELECT trip_id, route_id, Max(CountOfstop_id) AS MaxCountStops

 

FROM (

 

SELECT Stop_times.trip_id, Trips.route_id, Count(Stop_times.stop_id) AS CountOfstop_id

 

FROM Trips INNER JOIN Stop_times ON Trips.trip_id = Stop_times.trip_id

 

GROUP BY Stop_times.trip_id, Trips.route_id

 

ORDER BY Count(Stop_times.stop_id) DESC)

 

GROUP BY route_id); I connect with tester and via tester to new inline querier.

 

 

 

 

Regards

 

Tom

 

 

P.S. I'm using FME 2014 (SP4)

 

 

Best answer by takashi

Hi Tom,

 

 

Although the SQL syntax is basically standardized, there are variations in detail depending on database engines. Since the InlineQuerier uses SQLite internally, there are cases where a SQL statement works fine with MS Access but doesn't work with the InlineQuerier.

 

Probably this statement works as expected (hope there is no typo!).

 

-----

 

select * from route_max

 

inner join stop_times on stop_times.trip_id = route_max.trip_id

 

inner join stops on stops.stop_id = stop_times.stop_id

 

inner join trips on trips.trip_id = route_max.trip_id

 

inner join routes on routes.route_id = trips.route_id;

 

-----

 

 

In addition, if you test the statement with MS Access, you will have to surround join clauses by brackets, like this.

 

-----

 

select * from (((route_max

 

inner join stop_times on stop_times.trip_id = route_max.trip_id)

 

inner join stops on stops.stop_id = stop_times.stop_id)

 

inner join trips on trips.trip_id = route_max.trip_id)

 

inner join routes on routes.route_id = trips.route_id;

 

-----

 

 

Takashi
View original
Did this help you find an answer to your question?
This post is closed to further activity.
It may be a question with a best answer, an implemented idea, or just a post needing no comment.
If you have a follow-up or related question, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

2 replies

takashi
Influencer
  • Best Answer
  • March 21, 2015
Hi Tom,

 

 

Although the SQL syntax is basically standardized, there are variations in detail depending on database engines. Since the InlineQuerier uses SQLite internally, there are cases where a SQL statement works fine with MS Access but doesn't work with the InlineQuerier.

 

Probably this statement works as expected (hope there is no typo!).

 

-----

 

select * from route_max

 

inner join stop_times on stop_times.trip_id = route_max.trip_id

 

inner join stops on stops.stop_id = stop_times.stop_id

 

inner join trips on trips.trip_id = route_max.trip_id

 

inner join routes on routes.route_id = trips.route_id;

 

-----

 

 

In addition, if you test the statement with MS Access, you will have to surround join clauses by brackets, like this.

 

-----

 

select * from (((route_max

 

inner join stop_times on stop_times.trip_id = route_max.trip_id)

 

inner join stops on stops.stop_id = stop_times.stop_id)

 

inner join trips on trips.trip_id = route_max.trip_id)

 

inner join routes on routes.route_id = trips.route_id;

 

-----

 

 

Takashi

tva
Contributor
Forum|alt.badge.img+12
  • Author
  • Contributor
  • March 23, 2015
Thank you Takashi, it's working good now.

 

 

Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings