Re: MySql's equivalence to MsSql's 'TOP' command/function/clause
From: John Timney \(ASP.NET MVP\) (timneyj_at_despammed.com)
Date: 01/08/05
- Previous message: John Saunders: "Re: Datareader not working"
- In reply to: Kenneth P: "MySql's equivalence to MsSql's 'TOP' command/function/clause"
- Messages sorted by: [ date ] [ thread ]
Date: Sat, 8 Jan 2005 21:28:55 -0000
You want the The LIMIT clause which is used to limit the records returned by
the SELECT statement. You specify the start row (start from zero), and the
number of records returned.
SELECT * FROM search LIMIT 0, 10;
Have a look a the docs for mySQL
-- Regards John Timney ASP.NET MVP Microsoft Regional Director "Kenneth P" <KennethP@discussions.microsoft.com> wrote in message news:419599C1-8BE1-461B-AD6A-970CE45D6976@microsoft.com... > Hi, > > I'm trying to do some Custom Paging technique with the datagrid object and > with the select command in Sql, thus forcing the server to only select those > rows from the database that should be rendered in the datagrid object. > > This works fine with the code I have in MsSql2k but now I'm trying to do the > same with MySql v4.1 database and it doesn't support the 'TOP' > command/function/clause and I'm looking for some equivalence in MySql syntax, > but can't find it. > > What I have? > A DateTime column with some swedish 100% unique formatted dateTime rows, > there's exactly one second between every row, if necessary to get in exactly > unique in a bigger table I will have it to the thousend of a second > > 2003-01-01 00:00:01 > 2003-01-01 00:00:02 > ......... > 2003-01-01 00:31:45 > 2003-01-01 00:31:46 > > and so on . . . . > > An OdbcString with a DateTime table column named DatumTid, a DateTime > variable named varDatumTid > > Const PageSize = 20 > OdbcString = "Select Top " & PageSize.toString() & " * from testMySql " _ > & "Where DatumTid > '" & ViewState( "varDatumTid" ).toString() & "'" _ > & " Order By DATUMTID" > > What I need? > > An equivalence to the MsSql 'Top' command/function/clause in MYSql v4.1 > > Perhaps with some extra stuff around it to get it working. > > TIA > > Regards, > Kenneth P
- Previous message: John Saunders: "Re: Datareader not working"
- In reply to: Kenneth P: "MySql's equivalence to MsSql's 'TOP' command/function/clause"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|