Count of distinct in MySql
<p>I want to take count of distinct value in mysql.</p>

<pre><code>select 
    bank_sample_map.sample_track_id,sample_details.sample_id,order_number, order_details.sample_detail_id 
from 
    bank_sample_map 
left join 
    sample_details on bank_sample_map.sample_track_id = sample_details.sampletrack_id 
left join 
    order_details on order_details.sample_detail_id = sample_details.sample_id 
where 
    sample_detail_id = 559662
</code></pre>

<p>It returns </p>

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

<p>While Querying with distinct, It returns 2 rows</p>

<pre><code>select 
    DISTINCT(bank_sample_map.sample_track_id),sample_details.sample_id,order_number, order_details.sample_detail_id 
from 
    bank_sample_map 
left join 
    sample_details on bank_sample_map.sample_track_id = sample_details.sampletrack_id 
left join 
    order_details on order_details.sample_detail_id = sample_details.sample_id 
where 
    sample_detail_id = 559662
</code></pre>

<p>And while I am trying to take count, it returns 6. But I need the count 2.</p>