<p>I wish to find all rows in a table where one column is a substring of another column.</p>

<p>In other words, suppose I have a table (called people) with two columns: firstname and lastname, and I want to find all people like "rob robinowitz" and "jill bajillion".</p>

<p>Is there a way to do something like "select * from people where lastname like %firstname%"?  (But something which actually works).</p>

You were close
```
```
select * from people where lastname like '%' + firstname + '%'
```
```
Alternative way (may be even faster)
```
```
select * from people where charindex(firstname,lastname)>0
```
```