SELECT DISTINCT c.company_id, 
   FROM  company c, 
      authority a, 
      authority_lob alob
WHERE c.company_id = a.company_id 
  AND a.authority_id = alob.authority_id
  AND a.authority_status_id = 14
  AND alob.lob_id IN (1, 4, 5, 44, 45) 
ORDER BY c.company_nm

解决方案 »

  1.   

    If I want to display the "alob.lob_id", it returns several records with same company_id. Why DISTINCT doesn't work in this case?
      

  2.   

    你这样写是否对所有的字段的DISTINCT?试一下把c.company_id用括号括起来,写成DISTINCT(c.company_id)
      

  3.   

    这样写当然是对所有字段DISTINCT了。
      

  4.   

    样写是对所有字段DISTINCT了
    想返回唯一的company_id
    可以考虑group by