SQLite: Joining two select statements that include a count expression <p>I have a table containing a list of folders, each folder has an ID and Description</p> <pre><code>SELECT * FROM folders _id | description --------------------------- 1 | default 2 | test </code></pre> <p>I have an images table that contains a list of images, each image has a folderid</p> <pre><code>select folderid, count(*) as imagecount from images GROUP BY folderid; folderid| imagecount --------------------------- 1 | 4 2 | 5 </code></pre> <p>I want to be able to write a query that returns a list of all folders, with its description, and how many images is inside it</p> <pre><code>????? _id | description | imagecount ------------------------------------------------------ 1 | default | 4 2 | test | 5 </code></pre> <p>I tried the following query:</p> <pre><code>SELECT _id, description from folders, (select folderid, count(*) as imagecount from images GROUP BY folder) WHERE _id = folderid; </code></pre> <p>However it doesn't work, because it doesn't return the imagecount column. Any ideas?</p>