Steve
asked on
Left join issue
I need to write a query that returns all rows from tableA that do not exist in tableB where tableB is in another database. I can't use a simple sub-select so I have to use a left join, I think... The problem is that the query is returning to many rows so I must not have it right.
select *
from tableA a
left join server.db.owner.tableB a1 on a.number = a1.number
where a1.number is null
ASKER
The data types are nvarchar and char. That would lead me to believe the collations are different, unicode versus non-unicode.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
No luck guy, I still have the same number of rows as when I don't cast...
What is the output of your query and what is your expected result. give an example.
ASKER
Ugh, nevermind, I think I just found it. Thanks for your help!! Points are yours.
so, if you get too many records, then you have a data type issue, probably.
what is the data type (and collation) of the fields "number" in the 2 tables.