SQL Execute Query Syntax for INNER JOIN tables

Couldn’t find anything on this topic…

I need to perform a SQL query on a database, inner joining several datatabels. Db connection is working fine, but I’m getting a syntax error when executing the query:
"Execute Query: ERROR [HY000] [Data Direct][ODBC Progress OpenEdge Wire Protocol driver] [OPENEDGE] Syntax error in SQL statement at or about “[dtMain] INNER JOIN [dt1] ON [dt2” (10713)

Query looks like this:
SELECT dt1, dt2, dt3, dt4, dt5, dt6, dt7, dt8, dt9, dt10, dt11,dt12
FROM dtMain
INNER JOIN dt1 ON dt2 = dt3
INNER JOIN dt4 ON dt5 = dt6
INNER JOIN dt7 ON dt8 = dt9 AND dt10 = dt11

WHERE dt12= ‘123’

Have tried writing the syntax with and without brackets, but still getting the same error.

Think it has to do with the INNER JOIN-part, but have no clue how to solve this…

Hope that someone can help me, thanks!

Hi @IvoBC,

Here I have attached some links to know more about the inner. It helps you to get clear idea about inner join .

Regards
Balamurugan.S

Hi @balupad14,

Thanks for your quick reply!

I get the idea about the inner join function.
However, UiPath doesn’t seem to accept the join syntax in the query, I still get the same error at the first join.

Is there a special way to write it in the query?

Hope you can help me with that!

Cheers,
Ivo

Hi @IvoBC,

Just an idea, create your query as store procedure in the SQL database and call it from Uipath.

Hi @aanandsanraj,

Thanks for the tip, will have a go at it!

Hi @aanandsanraj,

Stored procedure won’t be possible…unfortunately…
Any other ideas or is there a way to write join syntax in UiPath?

Cheers!

I have tried a Inner Join Query and Its working fine .

select c.* from dt1 c INNER JOIN dt2 m on c.cDate=format(getdate(),‘yyyy-MM-dd’) and c.a=m.a and m.s=‘a’

@IvoBC
Did you check do you have the required privilege to access database?

Thanks, guys, solved it!
INNER JOIN is working… i used the incorrect notation for table names and columns…

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