Вы можете попробовать следующее:
<?php
$string = <<<XMLDoc
<?xml version='1.0'?>
<doc>
<title>XML Document</title>
<lotsofxml/>
<fruits>
XMLDoc;
$fruits = array('apple', 'banana', 'orange');
foreach($fruits as $fruit) {
$string .= "\n <fruit>".$fruit."</fruit>";
}
$string .= "\n </fruits>
</doc>";
?>
<html>
<!-- Show XML as HTML with entities; saves having to view source -->
<pre><?=str_replace("<", "<", str_replace(">", ">", $string))?></pre>
<textarea rows="8" cols="50"><?=$string?></textarea>
</html>
Сам ответил, но я не уверен, что это будет достаточно эффективное решение, когда таблица растет:
SELECT timestamp,method,id,response FROM rpc_responses
INNER JOIN
(SELECT max(timestamp),method,id FROM rpc_responses GROUP BY method,id) latest
USING (timestamp,method,id);
Понятие "новых" довольно неопределенно. Если Вы имеете в виду что-то как 100 новых строк тогда, можно просто добавить TOP(100)
к Вашему SELECT
пункт.
, Если Вы имеете в виду "новое" на основе новая дата тогда, можно просто сделать
SELECT timestamp,method,id,response
FROM rpc_responses
HAVING max(timestamp) = timestamp
... прошло больше года, но я могу кому-то помочь Чтобы выбрать все запросы, начиная с последнего
SELECT *
FROM rpc_responses
ORDER BY timestamp DESC
Try this...
SELECT o1.id, o1.timestamp, o1.method, o1.response
FROM rpc_responses o1
WHERE o1.timestamp = ( SELECT max(o2.timestamp)
FROM rpc_responses o2
WHERE o1.id = o2.id )
ORDER BY o1.timestamp, o1.method, o1.response
... это работает даже в Access!