On Sat, Dec 11, 2004 at 03:17:13PM +0100, Tomas Skäre wrote:
> select c.* from cjm_object c
>  inner join
>   (select max(timestamp) as timestamp,objectid,field from cjm_object
>    group by objectid,field) t
>   using(timestamp,objectid,field)
>  where 1=1 and data is not null
>  order by objectid,field;

Usually, SELECT max(field) FROM table is better written in PostgreSQL as
SELECT field FROM table ORDER field DESC LIMIT 1.

I don't see the point of "where 1=1", though...

/* Steinar */
-- 
Homepage: http://www.sesse.net/

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Reply via email to