On 11/10/11 12:55, Adarsh Sharma wrote:
> Thanks Craig, but I solved the issue by the below query :-
>
> Here is the query for that :-
>
> select bb_id,lat,lon,speed,dt_stamp from demo_table
> inner join
> (select bb_id as did, max(dt_stamp) as ts
> from demo_table group by bb_id) as ds
> on demo_table1.bb_id = ds.did and demo_table1.dt_stamp = ds.ts;
Yep, so you used the self-join method. That works, though it's probably
quite a lot slower than using a window function for the job.
I'm glad you found a suitable solution for your needs.
--
Craig Ringer