SQL Server join and wildcards

Posted by Ernst on Stack Overflow See other posts from Stack Overflow or by Ernst
Published on 2010-05-24T12:11:10Z Indexed on 2010/05/24 12:31 UTC
Read the original article Hit count: 332

Filed under:
|
|

I want to get the results of a left join between two tables, with both having a column of the same name, the column on which I join. The following query is seen as valid by the import/export wizard in SQL Server, but it always gives an error. I have some more conditions, so the size wouldn't be too much. We're using SQL Server 2000 iirc and since we're using an externally developed program to interact with the database (except for some information we can't retrieve that way), we can not simply change the column name.

SELECT table1.*, table2.* 
FROM table1 
LEFT JOIN table2 ON table1.samename = table2.samename

At least, I think the column name is the problem, or am I doing something else wrong?

© Stack Overflow or respective owner

Related posts about sql

Related posts about sql-server