Re: Extracting superlatives - SQL design philosophy

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Julien Theulier" <julien(at)squidsolutions(dot)com>
Cc: "'Mose'" <mose(dot)andre(at)gmail(dot)com>, "'Dave Crooke'" <dcrooke(at)gmail(dot)com>, "'pgsql-performance'" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Extracting superlatives - SQL design philosophy
Date: 2010-02-25 14:42:46
Message-ID: 2798.1267108966@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

"Julien Theulier" <julien(at)squidsolutions(dot)com> writes:
> Teradata provides a qualify syntax which works as a filtering condition on
> a windowed function result. This is the only DB allowing this direct
> filtering on windowed functions, from what I know.

Seems like you could easily translate that into SQL-standard syntax by
adding a level of sub-select:

select ... from (select *, window_function wf from ...) ss
where wf=1;

regards, tom lane

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Yu-Ju Hong 2010-02-25 21:23:53 dbt2 performance
Previous Message Julien Theulier 2010-02-25 09:20:45 Re: Extracting superlatives - SQL design philosophy