create table #tbltest (firstname varchar(20),lastname varchar(20))
insert into #tbltest(firstname, lastname) values('smith','john')
insert into #tbltest(firstname, lastname) values('smith','john')
insert into #tbltest(firstname, lastname) values('tsmith','john')
insert into #tbltest(firstname, lastname) values('tsmith','john')
insert into #tbltest(firstname, lastname) values('ttsmith','john')
insert into #tbltest(firstname, lastname) values('ttsmith','john')
select...