Group query:
Https://www.cnblogs.com/netserver/p/4518995.html
Date format format:
http://blog.csdn.net/qq_16769857/article/details/52289627
Conversions between dates and strings:
Https://www.cnblogs.com/windphoenix/archive/2013/04/26/3044784.html
Fuzzy Query for Date:
Https://zhidao.baidu.com/question/507141127.html
SELECT a.*
From Waterquarter a INNER JOIN
(SELECT DATACD, MAX (TM) TM
From Waterquarter
GROUP by DATACD) b on a.datacd = B.DATACD and a.tm = B.tm
and CONVERT (varchar, a.tm, 23°c) like ' 2017-11-24% '
ORDER by A.tm DESC
SELECT a.*
From Waterquarter a INNER JOIN
(SELECT DATACD, MAX (TM) TM
From Waterquarter
GROUP by DATACD) b on a.datacd = B.DATACD and a.tm = B.tm
WHERE CONVERT (varchar, a.tm, 23°c) like ' 2017-11-24% '
ORDER by A.tm DESC
SELECT a.*
From Waterquarter a INNER JOIN
(SELECT DATACD, MAX (TM) TM
From Waterquarter
GROUP by DATACD) b on a.datacd = B.DATACD and a.tm = B.tm and
CONVERT (varchar, a.tm, 23°c) like convert (varchar, GETDATE (), 23)
ORDER by A.tm DESC
SQL Server group query combined with date fuzzy query