简短问题,限制条款将在Postgresql中的哪个位置? 我想将行数限制为10,但是当我这样做时它会给我一个错误;
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
它在“where”
处或附近给出了语法错误(如果需要,我可以添加select语句。
答案 0 :(得分:2)
limit
是select
查询中的最后一个子句,因此它位于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;