 <p><code>order by</code> should after <code>where</code> clause</p> <pre><code>"SELECT Products.ProductID, Products.Name, Categories.CatName, " + "Products.Description, Products.Price FROM Products INNER JOIN Categories ON " + "Products.CatID = Categories.CatID " + "WHERE " + column + " LIKE '%" + keyword + "%'"; "ORDER BY Products.Price DESC" </code></pre> <p>And as other comment said, you should consider use <code>SQLParameters</code> to avoid <strong>SQL Injection</strong></p>