On Mon, Feb 7, 2011 at 00:03, Mikkel Lauritsen wrote:
>>> SELECT * FROM table t1 WHERE 0 = (SELECT COUNT(*) FROM table t2 WHERE
>>> t2.type = t1.type AND t2.timestamp > t1.timestamp)
>>
>> I suspect that *any* database is going to have trouble optimizing that.
> Just out of curiosity I've bee
Hi Tom et al,
Many thanks for your prompt reply - you wrote:
>> SELECT * FROM table t1 WHERE 0 = (SELECT COUNT(*) FROM table t2 WHERE
>> t2.type = t1.type AND t2.timestamp > t1.timestamp)
>
> I suspect that *any* database is going to have trouble optimizing that.
Okay, I expected that much.
Mikkel Lauritsen writes:
> I would like to do a query which retrieves the newest record for each
> type, and the persistence framework that I'm using does something
> which is structurally like
> SELECT * FROM table t1 WHERE 0 = (SELECT COUNT(*) FROM table t2 WHERE
> t2.type = t1.type AND t2.
Hi all,
I have a execution planner related issue that I'd like to have some help
in understanding a bit deeper -
I have a table which basically contains fields for a value, a timestamp
and
a record type which is an integer. I would like to do a query which
retrieves
the newest record for each typ