Get first/second/third element from sql query
<p>I have a sql query like </p>

<pre><code>SELECT id FROM chart WHERE name='qwertz' AND run_id=3
</code></pre>

<p>I know that this query will return 3 datasets. For another complex query I need the first/second/third id that returned my query above like </p>

<pre><code>SELECT value FROM data WHERE id=(SELECT id FROM chart WHERE name='qwertz' AND run_id=3).getFirst

 SELECT value FROM data WHERE id=(SELECT id FROM chart WHERE name='qwertz' AND run_id=3).getSecond

 SELECT value FROM data WHERE id=(SELECT id FROM chart WHERE name='qwertz' AND run_id=3).getThird
</code></pre>

<p>How can I do it?</p>