比如直接使用: SELECT distinct mobileFROM table_aWHERE code = 123ORDER BY a_ime desc 在本地mysql数据库没有错,在线上的数据库就会报如下错(估计是版本的问题):Expression #1 of ORDER BY clause is not in SELECT list, references column 'table_a.a_time' which is not in SELECT list 大意是:order by 的…
update ptop_investrecord set delflag = 1 where cid = 250 and uid = 92569 and delflag = 0 and progress = 1 and comefrom = '5' and ptopRecordId = '253274' and id not in (select tmp.myid FROM (SELECT min(id) as myid from ptop_investrecord as tmp wher…
今天在写代码的时候要对数据进行去重,正打算使用Distinct方法的时候,发现这个用了这么久的东西,竟然不知道它是怎么实现的,于是就有了这篇文章. 使用的.net core2.0 1.需求 假如我们有这样一个类 public class Model { public int Code { get; set; } public int No { get; set; } public override string ToString() { return "No:" + No + &quo…