title: Unable to fetch correct image path from table
body: <p>I am trying to fetch users id,fname,lname,image from Profile album with cover value Yes.</p>
  
  <p>I am using following query</p>
  
  <pre><code>select distinct
          a.id as id,
          a.fname as fname,
          a.lname as lname,
         im.sm_pic_path as image,
         im.is_album_cover as cover,
          album.name as album
      from
          user a 
      left outer join
          images im 
              on a.id=im.aid 
      left outer join
          album album 
              on im.album_id=album.id 
      where
  
              a.fname like '%man%'
              or a.lname like '%man%'
  
          and a.status='active' 
          and im.is_album_cover='Yes' 
          and album.name='Profile'
          group by a.id
      order by
          im.sm_pic_path desc,a.id 
            limit 0,30
  </code></pre>
  
  <p>This query is working without error but it is not fetching correct image.
  I want image whose album name is profile and is_album_cover value is yes.</p>
  
  <p>How to make this correct.</p>