Re: [SQL] Simulating LIMIT/OFFSET in a subquery

2001-02-11 Thread Tom Lane
"Jamie Walker" <[EMAIL PROTECTED]> writes: > But of course, ORDER BY and LIMIT are not allowed in sub-queries. FWIW, they are allowed as of 7.1 ... regards, tom lane

[SQL] Simulating LIMIT/OFFSET in a subquery

2001-02-11 Thread Jamie Walker
I need to write querys that return the second and third record from a 'visits' table, for each patient. (What I need to do is look at how many patients were diagnosed on the first/second/third visit to see a physician at the outpatient clinic). I can get at the first visit using DISTINCT ON: S