1
Hellow Manoj,
You can make multiple condition left join in this situation...
- create table Books
- (
- BookID int primary key identity(1,1),
- Name varchar(max),
- Autor varchar(max)
- )
- create table Chars
- (
- SelfID int primary key identity(1,1),
- StartCharacter varchar(1),
- EndCharacter varchar(1)
- )
-
- insert into Books(Name,Autor) values ('ABC','Manoj')
- insert into Books(Name,Autor) values ('BBC','mnoj')
- insert into Chars(StartCharacter,EndCharacter) values ('A','C')
- insert into Chars(StartCharacter,EndCharacter) values ('D','I')
-
- select bk.*, ch.SelfID
- from Books bk
- left join Chars ch
- on ch.StartCharacter = SUBSTRING(bk.Name, 1, 1) and
- ch.EndCharacter = SUBSTRING(bk.Name, LEN(bk.Name), 1)