Re: [SQL] numbered table? - Mailing list pgsql-sql

From UEBAYASHI Masao
Subject Re: [SQL] numbered table?
Date
Msg-id 19991215164328A.masao@nf.enveng.titech.ac.jp
Whole thread Raw
In response to Re: [SQL] numbered table?  ("UEBAYASHI 'UMA' Masao" <masao@nf.enveng.titech.ac.jp>)
Responses Re: [SQL] numbered table?
List pgsql-sql
> I've found a topic near my question, ranking, in ``SQL FOR
> SMARTIES''. Thanks.

At last, I dumped this ranking method. Celko's suggestion was:
 SELECT T1.attrib0, T1.attrib1,   (SELECT COUNT(DISTINCT attrib1)      FROM Table AS T2        WHERE (T2.attrib1 >=
T1.attrib1)         AND (T2.attrib0 = T1.attrib0)) AS rank   FROM Table AS T1     WHERE rank <= :n;
 

or
 SELECT T1.attrib0, T1.attrib1,   (SELECT COUNT(attrib1)      FROM Table AS T2        WHERE (T2.attrib1 >= T1.attrib1)
       AND (T2.attrib0 = T2.attrib0)) AS rank   FROM Table AS T1     WHERE rank <= :n;
 

Unfortunately, neither don't run in PostgreSQL.

Masao


pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: [SQL] Search optimisation
Next
From: Patrick JACQUOT
Date:
Subject: Re: [SQL] SQL'92 web resources