Join query

[expired user #11137]'s profile image [expired user #11137] posted 6 years ago in Running SQL scripts Permalink

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?

[expired user #11137]'s profile image [expired user #11137] posted 6 years ago Permalink

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's profile image ansgar posted 6 years ago Permalink

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.