SQL LIMIT with WHERE clause

Is it possible to use LIMIT x with a WHERE clause? If so, how?

I am trying to do this:

select * from myVIew LIMIT 10 where type=3;

But I get the following error:

ERROR:  syntax error at or near "where"
LINE 2: where type=3;
        ^
********** Error **********
ERROR: syntax error at or near "where"
SQL state: 42601
Character: 44
+5
source share
3 answers
select * from myVIew  where type=3 LIMIT 10;

Limitshould be after where clause.

Syntax:

SELECT column_name(s)
FROM table_name
[WHERE]
LIMIT number;
+15
source

Yes, have you tried this?

select * from myVIew  where type=3 LIMIT 10;

Have a look here for further links . LIMITafter the suggestions WHEREand ORDER BYwhat makes the general sense, if you stop and think about it: first you must define your basic result set (filters and orders), then you limit it / page.

+5
source
 select * from myVIew where type=3  LIMIT 10;
+2

All Articles