Question

Short Question, where would the limit clause go in Postgresql? I want to limit the amount of rows to 10, but it is giving me an error when I do;

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

It's giving me a syntax error at or near "where"

(If requested, I could add the select statement.

Was it helpful?

Solution

limit is the last clause in a select query, so it goes after the 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;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top