SolveItproblems

SolveITProblems is a project of QFormat.net intellectual club

SolveITProblems это проект интеллектуального клуба QFormat.net

среда, 11 августа 2010 г.

MS SQL top 2 MySQL limit

When you use MS SQL server you can write a query like this:

SELECT TOP 5 * FROM TABLE

It will return first five rows from the table, and if you use ORDER BY clause at the end this type of query is very useful.
So writing query on MySQL with TOP is impossible... :( . But MySQL has a better solution - LIMIT.

You can write queries like this:

SELECT * FROM TABLE LIMIT 0,12

This query will return 12 records from the first (0) record. You can write even

SELECT * FROM TABLE LIMIT 12,12

This query will return 12 records from 12th record. So this 2 records can be used to divide information into 2 pages by 12 elements.

Комментариев нет:

Отправить комментарий