SQL DB Looping joining multiple tables error

Hello,

I need to pull data from an SQL database and shortlisting the output by considering another table.(schema below)

With the SQL query, I’m trying to pull data by joining different tables, but I am facing this error that I cannot solve.

If I paste the query in a Query Reader and click on Evaluate, this is the result:

Hi @gt4 , Welcome to the KNIME community!

In the DB Query reader, the preview tries to wrap you query with

select * from ( *yourquery*) as temptablename LIMIT 10

so that it can preview the first 10 rows.

The problem is that your query contains -- comments

Your entire query is taken as a single string and linefeeds are ignored when this gets turned into the “preview query”, and as a result the first of those comments effectively comment out the remainder of the query.

Either remove the comments or replace
-- mycomment
with
`/* mycomment */

I can’t say that this is the cause of your general problem (there may be something else wrong) but hopefully this will move you forward

2 Likes

Hi @takbb,
thank you for your suggestion.

The real hurdle was with group by all. I tried to remove group by all and use group by 1,2,3,etc. and it worked. It seems that it does not like the group by command.

Hi @gt4, I’ve not encountered group by all before, and even group by [ordinal list] doesn’t work with a number of sql dialects, but I’m glad you got it working.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.