Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Problem with query involving "limit"

Author  Topic 

nickkrym
Starting Member

4 Posts

Posted - 2005-04-23 : 14:40:44
sorry for wasting bandwidth with basic questions, but i cant seem to get this to work Sad
I am using a sql query like this:
$sql = "SELECT * from people WHERE type='client'";
very basic as you can see. now i want to add a limit:
$sql = "SELECT * from people WHERE type='client' ORDER BY personID ASC LIMIT 0, 10";
this, for some reason, keeps giving me errors
"Warning: mssql_query() [function.mssql-query]: message: Line 1: Incorrect syntax near 'LIMIT'. (severity 15) in E:\Program Files\Apache Group\Apache2\htdocs\ykoon\clients.php on line 81"

iv tried everything, even this gives me the same error:
$sql = "SELECT * from people WHERE type='client' LIMIT 10";

robvolk
Most Valuable Yak

15732 Posts

Posted - 2005-04-23 : 14:54:22
You'll have better luck in a MySQL forum, we deal with Microsoft SQL Server. Have a look here:

http://dbforums.com/
Go to Top of Page

nickkrym
Starting Member

4 Posts

Posted - 2005-04-23 : 14:58:29
this is mssql....
"Warning: mssql_query() [function.mssql-query]: message: Line 1: Incorrect syntax near 'LIMIT'. (severity 15) in E:\Program Files\Apache Group\Apache2\htdocs\ykoon\clients.php on line 81"
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2005-04-23 : 15:15:47
SQL Server does not use LIMIT, only MySQL does. Search this site for "TOP" to find alternatives you can use for SQL Server.
Go to Top of Page
   

- Advertisement -