我的sql 语句是这样的: [b]strsql= "select id,道路代码,道路名称,病害大类 from " + tableName + " where 病害大类 like '" + xunsifl + "' and 修复完工='是' group by id,道路代码,道路名称,病害大类, order by 采集日期 desc" ;
...全文
2113打赏收藏
order by中出现的字段如何不再group by中出现?
我只想根据 id,道路代码,道路名称,病害大类 这几个字段分组,不能要日期,但我又必须依日期排倒序,sql语句该怎么写? 我的sql 语句是这样的: [b]strsql= "select id,道路代码,道路名称,病害大类 from " + tableName + " where 病害大类 like '" + xunsifl + "' and 修复完工='是' group by id,道路代码,道路名称,病害大类, order by 采集日期 desc" ;
strsql= "select id,道路代码,道路名称,病害大类,采集日期 from " + tableName + " where 病害大类 like '" + xunsifl + "' and 修复完工='是' group by id,道路代码,道路名称,病害大类, order by 采集日期 desc" ;