Re: [SQL] numbered table?
От | UEBAYASHI Masao |
---|---|
Тема | Re: [SQL] numbered table? |
Дата | |
Msg-id | 19991215164328A.masao@nf.enveng.titech.ac.jp обсуждение исходный текст |
Ответ на | Re: [SQL] numbered table? ("UEBAYASHI 'UMA' Masao" <masao@nf.enveng.titech.ac.jp>) |
Ответы |
Re: [SQL] numbered table?
|
Список | 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 по дате отправления: