That is to be expected. When you join on the id column and in the where clause specify that b.id is null, what you are requesting of SQL Server is to return all rows for which there were no matching rows in table b. Since there is no matching row in table b, there cannot be value for the date column in table b for that row as well.

I didn't quite understand the logic you are trying to implement, but it seems like you need to join on something else other than id's. When you say "if the id columns don't match", that means you are (in your thought process) matching a row in table a with a row in table b using some other criterion. What is that criterion? That is what you would need to use in the join clause.

I had extracted some info that is not in matching in table a and table b, in this case the ID_col extracted are ID's not matching in both files

With that extraction I have to use address_col to link a date_col coming from table b.

So SQL I will copy the date_col in the extracted file, using an address_col as the link between them.

The matter is that the output given in date_col is just working for some rows not for all of them...

Thank you james

quote:Originally posted by James K

That is to be expected. When you join on the id column and in the where clause specify that b.id is null, what you are requesting of SQL Server is to return all rows for which there were no matching rows in table b. Since there is no matching row in table b, there cannot be value for the date column in table b for that row as well.

I didn't quite understand the logic you are trying to implement, but it seems like you need to join on something else other than id's. When you say "if the id columns don't match", that means you are (in your thought process) matching a row in table a with a row in table b using some other criterion. What is that criterion? That is what you would need to use in the join clause.

It is hard for me to follow the logic and data flow from your description. If you post the table schema and some representative sample data indicating the problem areas, that would help. Take a look at this page if you need help in posting schema and sample data: http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

It is hard for me to follow the logic and data flow from your description. If you post the table schema and some representative sample data indicating the problem areas, that would help. Take a look at this page if you need help in posting schema and sample data: http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx