日期:2014-05-17 浏览次数:20477 次
SELECT PhotoID, PhotoUrl, PublishDate FROM PhotoInfo, (SELECT FORMAT(PublishDate, 'yyyy-mm-dd') AS PDate, MAX(PhotoID) AS PID FROM PhotoInfo GROUP BY FORMAT(PublishDate, 'yyyy-mm-dd')) t1 WHERE t1.PID=PhotoInfo.PhotoID AND PublishDate>=#2013-10-1 0:00:00# AND PublishDate<#2013-11-1 0:00:00#
SELECT PhotoID, PhotoUrl, PublishDate
FROM PhotoInfo,
(SELECT CONVERT(varchar(10),PublishDate,120) AS PDate, MAX(PhotoID) AS PID
FROM PhotoInfo
GROUP BY CONVERT(varchar(10),PublishDate,120)
) t1
WHERE t1.PID=PhotoInfo.PhotoID
AND CONVERT(varchar(10),PublishDate,120)>='2013-10-01'
AND CONVERT(varchar(10),PublishDate,120)<'2013-11-01'