Count number of rows for specific ID
<p>In first table <code>album</code> has id and second table <code>album_details</code> has <code>sub_id</code> which relates from <code>album</code> table <code>id</code></p>

<p><a href="https://i.stack.imgur.com/RwZ8M.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RwZ8M.png" alt="enter image description here"></a></p>

<p><a href="https://i.stack.imgur.com/qob0z.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qob0z.png" alt="enter image description here"></a></p>

<p>I need to display count for separate id value.</p>

<pre><code>SELECT DISTINCT B.SUB_ID, A . * , B.CONTENT_VALUE AS detail, 
(SELECT COUNT( ID ) 
FROM album_details WHERE A.ID = B.SUB_ID ) AS count
FROM album AS A, album_details AS B
WHERE A.WEBSITE_ID =  '571710720'
AND A.ID = B.SUB_ID
GROUP BY B.SUB_ID
LIMIT 0 , 30
</code></pre>

<p>Now count column shows 40 for all rows but need to display 'count' 6 for 'id=4', 'count' 3 for 'id=2'</p>