views:

89

answers:

5

Drupal uses db_query_range() for the reason that not all databases support LIMIT,

can you name a few?

+3  A: 

Microsoft SQL Server does not support LIMIT. It supports the TOP statement which can be used to accomplish similar things. The primary limitation with TOP is the inability to specify an offset.

Asaph
Yeah, would be good if TOP worked with OVER(PARTITION BY ... ORDER BY ...) too
Chris Bednarski
+2  A: 

ms sql, oracle.

and actually LIMIT doesn't exists in ANSI SQL '92 which all modern databases should follow. so currently it's just an unnecessary extension/syntactic sugar/specific sql dialect

zerkms
+2  A: 

DB2, Oracle, and MS SQL Server do not support the LIMIT clause.

Google for <database name> LIMIT, and you'll get to know the equivalent supported clause for that database, or whether LIMIT itself is supported.

Hippo
+6  A: 

DB2, MSSQL, Oracle, and Informix all do not support LIMIT. As a matter of fact, it's not in the SQL standard. (The standard one is "FETCH FIRST" indeed)

Here is a good source for SQL comparisons: http://troels.arvin.dk/db/rdbms/#select-limit

shinkou
A: 

On the flip side, ANSI-92 SQL provides the ROW_NUMBER() window function for achieving this, which is supported on many databases. See SELECT (SQL) on Wikipedia.

mdma