I am using MS SQL SERVER 2008R2 . I have two tables A and B as
create table A( id int primary key, name Varchar(20)); create table B( id int primary key, user_name Varchar(20)); insert into A values(1,'A1'); insert into A values(2,'A2'); insert into A values(3,'A3'); insert into A values(4,'A4'); insert into A values(5,'A5');
Now my problem is:
select A.* from A left outer join B on A.id = B.id where B.user_name like '%';
or
select A.* from A left outer join B on A.id = B.id where B.user_name like '%%';
The above written query does not return any records, although there are 5 records in the left table. without a filter on the right table it works fine.
source share