<p>The original query looks like this (MySQL):</p>

<pre><code>SELECT * 
FROM books 
WHERE title LIKE "%text%" OR description LIKE "%text%" 
ORDER BY date
</code></pre>

<p>Would it be possible to rewrite it (without unions or procedures), so that result will look like this:</p>

<ul>
<li>list of books where title matches query ordered by date, followed by:</li>
<li>list of books where description matches query ordered by date</li>
</ul>

<p>So basically just give a higher priority to matching titles over descriptions.</p>

The union command will help you. Something along these lines:
```
```
SELECT *, 1 as order from books where title like '%text%'
union
SELECT *, 2 as order from books where description like '%text%'
ORDER BY order, date
```
```