Select X using where clause and Y not using where clause
<p>I'm trying to figure out if it's possible to do a query like:</p>

<pre><code>Select 5 from pictures where likes &lt; 5 &amp;&amp; select 4 from pictures
</code></pre>

<p>Basically, have a where clause on the first 5 pictures, and get 4 more pictures (but making sure that these other 4 pictures are not the same as those first 5 pictures)..</p>

<p>This is what I have so far:</p>

<pre><code>SELECT * FROM `pictures` WHERE `likes` &lt; 5 GROUP BY id desc limit 0,5;
</code></pre>

<p>This is the result that I hope to get:</p>

<pre><code>Picture 1 (Using where clause)
Picture 2 (Using where clause)
Picture 3 (Using where clause)
Picture 4 (Using where clause)
Picture 5 (Using where clause)
Picture 6 (Randomly selected from pictures, but making sure that this isn't a duplicate)
Picture 7 (Randomly selected from pictures, but making sure that this isn't a duplicate)
Picture 8 (Randomly selected from pictures, but making sure that this isn't a duplicate)
Picture 9 (Randomly selected from pictures, but making sure that this isn't a duplicate)
</code></pre>

<p>Basically, whenever I query it, I want all rows to be unique.</p>