Forum OpenACS Q&A: Response to Porting Oracle's ROWNUM

Collapse
Posted by Roberto Mello on
That's exactly what I am trying to do... Thanks Don.

However, this brought me to another question. This is the query I am working on:

     select * from (
        select log_id, job_id, to_char(stamp, 'MM-DD HH:MI:SS') as stamp, log_msg
        from cs_processing_log
        where $job_id_condition
        order by log_id desc
     )
     where rownum <= 10
     order by log_id
In my tests PG does not seem to accept the outer select * from (). Am I correct?

In this particular case, would it seem plausible for me to rewrite this query as:

        select log_id, job_id, to_char(stamp, 'MM-DD HH:MI:SS') as stamp, log_msg
        from cs_processing_log
        where $job_id_condition
        order by log_id desc
	limit 10
Thanks.