//Display the top 40 % of rows in BB_DEPARTMENT

SQL> select ROWNUM,ID FROM EMPLOYEES WHERE ROWNUM < .3*(SELECT COUNT(ID) FROM BB
_DEPARTMENT) GROUP BY ROWNUM,ID;

    ROWNUM
----------
         1
HTH
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
 
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger 
sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung 
oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem 
Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. 
Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung 
fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le 
destinataire prévu, nous te demandons avec bonté que pour satisfaire informez 
l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est 
interdite. Ce message sert à l'information seulement et n'aura pas n'importe 
quel effet légalement obligatoire. Étant donné que les email peuvent facilement 
être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité 
pour le contenu fourni.




> From: nboutel...@gmail.com
> Subject: [GENERAL] Return 30% of results?
> Date: Fri, 18 Sep 2009 14:31:29 -0700
> To: pgsql-general@postgresql.org
> 
> Is there a way to return a percentage of the rows found? I tried
> window functions but get an error...
> 
> ERROR:  syntax error at or near "OVER"
> 
> SELECT id, cume_dist FROM (
>   SELECT id, cume_dist() OVER (ORDER BY id) FROM employees
> ) s
> WHERE cume_dist < 0.3
> 
> -- 
> Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general

_________________________________________________________________
Hotmail: Powerful Free email with security by Microsoft.
http://clk.atdmt.com/GBL/go/171222986/direct/01/

Reply via email to