Join query

ok.kot posted 1 month ago in Running SQL scripts

Hello!

I need to join 2 tables from different databases which have different session managers too. my query looks like:

select n.col1,n.col2 r.col1, r.col2, r.col3 from db1.table1 n join db2.table2 r on r.col1 = n.col1

this query returned me an error could you help me please?

ok.kot posted 1 month ago

Hello!

I need to join 2 tables from different databases which have different session managers too. my query looks like:

select n.col1,n.col2 r.col1, r.col2, r.col3 from db1.table1 n join db2.table2 r on r.col1 = n.col1 ```>

this query returned me an error could you help me please?

ansgar posted 1 month ago

There is a column missing after n.col2, so I'd say:

SELECT n.col1, n.col2, r.col1, r.col2, r.col3
FROM db1.table1 n
JOIN db2.table2 r ON r.col1 = n.col1

By the way: Indent your SQL code to help yourself finding errors.

Please login to leave a reply, or register at first.