Re: MySql's equivalence to MsSql's 'TOP' command/function/clause

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: John Timney \(ASP.NET MVP\) (timneyj_at_despammed.com)
Date: 01/08/05

  • Next message: fadi: "Re: Good ASP.NET Hosts"
    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
    

  • Next message: fadi: "Re: Good ASP.NET Hosts"

    Relevant Pages

    • MySqls equivalence to MsSqls TOP command/function/clause
      ... rows from the database that should be rendered in the datagrid object. ... command/function/clause and I'm looking for some equivalence in MySql syntax, ... A DateTime column with some swedish 100% unique formatted dateTime rows, ... An equivalence to the MsSql 'Top' command/function/clause in MYSql v4.1 ...
      (microsoft.public.dotnet.framework.aspnet)
    • Re: migration from mysql to oracle - problems with time data type
      ... The various tables include a mysql data types datetime, ... I can change the existing time fields to timestamp and ... mysql (or have become timestamps in Oracle). ...
      (comp.databases.oracle.misc)
    • Re: Building a news management system (full story)
      ... I'm building a news site, to wich a user can add new items into a mySQL ... creation (datetime) // datetime when item was created ... is it even a MySQL problem? ...
      (comp.lang.php)
    • migration from mysql to oracle - problems with time data type
      ... The various tables include a mysql data types datetime, ... I can change the existing time fields to timestamp and ... mysql (or have become timestamps in Oracle). ...
      (comp.databases.oracle.misc)
    • Re: MySQL to SQL
      ... basically I want to take a MySql script and load it into a SQL database. ... BIOS_RELEASE_DATE datetime default NULL, ... CUSTOM_TEXT_FIELD1 mediumtext, ...
      (microsoft.public.scripting.wsh)