Ads were blocked - no problem. But keep in mind that developing HeidiSQL, user support and hosting takes time and money. You may want to send a donation instead.

Join query

ok.kot's profile image ok.kot posted 5 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?

ok.kot's profile image ok.kot posted 5 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 5 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.




Ads were blocked - no problem. But keep in mind that developing HeidiSQL, user support and hosting takes time and money. You may want to send a donation instead.