Maybe this question is duplicate, but I can not find an answer for my task. I have the next table with following data:

I need to select data with unique oid and with max date for each oid. I have these queries, but they work incorrectly:
SELECT `oid`, `pvalue`, `date`
FROM `report`
WHERE `deviceid` = 'MRA-1011'
AND `date` <= '2012-01-20 00:00:00'
GROUP BY oid
HAVING `date` = MAX(`date`)
ORDER BY `date` DESC;
SELECT `oid`, `pvalue`
FROM `report`
WHERE `deviceid` = 'MRA-1011'
AND `date` <= '2012-01-20 00:00:00'
GROUP BY oid
ORDER BY `date` DESC;
I want to get this result:
