| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | Martijn van Oosterhout <kleptog(at)svana(dot)org> |
| Cc: | Ben <bench(at)silentmedia(dot)com>, pgsql-general(at)postgresql(dot)org |
| Subject: | Re: oracle's first_value function for postgres? |
| Date: | 2005-09-13 21:50:31 |
| Message-ID: | 26970.1126648231@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
Martijn van Oosterhout <kleptog(at)svana(dot)org> writes:
> On Tue, Sep 13, 2005 at 12:15:21PM -0700, Ben wrote:
>> Oracle has a very handy function called first_value, which can be used
>> to turn a set like this:
> Look at DISTINCT ON ()
>> Does postgres have something equivalent, or, even better, is there a
>> reasonable way to express this in standard SQL?
> In standard SQL, not really, which is why it's an extention...
Another way is to create an aggregate with a no-op transition
function ... also nonstandard, but you might be able to duplicate
Oracle's syntax that way.
regards, tom lane
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Scott Marlowe | 2005-09-13 22:01:10 | Re: Replication |
| Previous Message | Jerry LeVan | 2005-09-13 21:30:19 | Pushing result set to table on different machine? |