I have two tables that I want to join.

The case is in table 1 the default value is 1 then in table 2 the default value is 0

```
Table 1       Table 2
--------     ---------
1            0
1232342      1232342
1241232      1231231

```

I want to join table 1 and table 2 with condition that if table 2 is 0 then it will be replaced to 1.

```
SELECT T1.ID 
FROM TABLE1 T1, TABLE2 T2
WHERE T1.ID = REPLACE(CASE WHEN T2  = 0 THEN 1 ELSE T2.ID END, 'X', 'E')

```

with this statement it does not return the other id's that are not 0 or 1

expected output

```
Table 1      
--------     
1           
1232342      

```