1
我有数据库表日志如下所示:查询最后条目组由DEVICEID
alt text http://www.freeimagehosting.net/uploads/16e974703a.jpg
我想提取设备,pollDate,状态中的最后一项。例如。
DEVICEID,pollDate,状态
1,2010-95-06 10点53分28秒,1
3,2010-95-06 10时26分28秒,1
我试图运行下面的查询,但在不同的只选择第一条记录,而不是最新
SELECT DISTINCT deviceId, pollDate, status
FROM logs
GROUP By deviceId
ORDER BY pollDate DESC
alt text http://www.freeimagehosting.net/uploads/5d181103f8.jpg
那么,你能帮我从表格中提取最新的条目吗?谢谢。