2014-05-09 3 views
-2

Question courte, où la clause de limite entrerait-elle dans Postgresql? Je veux limiter le nombre de lignes à 10, mais il me donne une erreur quand je le fais;Où irait l'instruction Limit? Postgresql

From this_table x 
    join this_table y 
    on x.no = y.no 


where x.no = '7' 
Limit 10 
group by x.location 
order by x.location 

Il me donne une erreur de syntaxe ou à proximité « où »

(demande, je pourrais ajouter l'instruction select.

+0

http://www.postgresql.org/docs/current/static/sql-select.html –

Répondre

2

limit est la dernière clause dans une requête select, il va après la order by:

select <whatever> 
From this_table x 
    join this_table y 
    on x.no = y.no 
where x.no = '7' 
group by x.location 
order by x.location 
Limit 10;