SELECT distinct * FROM tb_document WHERE (state = '6') AND (content LIKE '%女孩%') ORDER BY createtime DESC

解决方案 »

  1.   

    ???SELECT distinct * FROM tb_document WHERE (state = '6') AND (content LIKE '%女孩%') ORDER BY createtime DESC
      

  2.   

    SELECT 
        a.* 
    FROM 
        tb_document a
    WHERE 
        a.state = '6' 
        AND 
        a.content LIKE '%女孩%'
        AND 
        a.createtime = (select 
                            top 1 createtime 
                        from 
                            tb_document 
                        where 
                            state = a.state 
                            and 
                            content LIKE '%女孩%' 
                            and 
                            title = a.title 
                        order by 
                            createtime)
    ORDER BY 
        a.createtime DESC
      

  3.   

    找到了SELECT * FROM aaa WHERE a1 IN(SELECT MIN(a1) FROM aaa GROUP BY a3)