proper way of using OR inside sql statement

.net c# dapper

Question

I'm using dapper micro orm in conjuction with sql server.

 string author = "some author name";
 var get_book_from_name = "SELECT BookId FROM Author WHERE FirstName OR LastName LIKE('%' +@AuthorName +'%')";
 var data = this.db.Query<Book>(getBookFromAuthorName, new { AuthorName = author }).SingleOrDefault();

and I'm getting error using OR statement in query statement.

Accepted Answer

SELECT BookId FROM Author WHERE
    FirstName LIKE '%'+@AuthorName+'%' OR LastName LIKE '%'+@AuthorName+'%'


Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why