distinct去重,如果遇到text字段,可以用以下方法解决 1.用not exists select * from tab awhere not exists ( select 1 from tab b where b.col1 = a.col1 and b.col2 = a.col2 ... ) 2.转成字符型CONVERT(VARCHAR(8000),你的字段) select distinct * from ( select id, convert(varchar(8000),
一.SQLite入门语句之HAVING HAVING 子句允许指定条件来过滤将出现在最终结果中的分组结果. WHERE 子句在所选列上设置条件,而 HAVING 子句则在由 GROUP BY 子句创建的分组上设置条件. 1.获取满足条件A的数据分组后还满足条件B的数据 select * from table_name where [condition_A] group by 字段A having [condition_B] 注:HAVING 子句必须放在 GROUP BY 子句之后,必须放在 O