Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. 3rd Party Software
  4. SQLite Limit Query ignor the starting row number
Forum Updated to NodeBB v4.3 + New Features

SQLite Limit Query ignor the starting row number

Scheduled Pinned Locked Moved 3rd Party Software
3 Posts 2 Posters 6.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    umen242
    wrote on last edited by
    #1

    Im trying to fetch rows with the LIMIT clause . but what im getting is all the rows untill the limit for example if i execute :
    (this is in the QSqlQueryModel )

    @QString queryFullTextSearch = "SELECT * FROM my_table LIMIT 20,40";
    QSqlQueryModel::setQuery(queryFullTextSearch, queryDB);
    @

    what im getting is the rows from 0 to 40. and if next im executing it from 40 to 80
    what im getting is the rows from 0 to 80.
    is there a problem in the way im executing the query?

    1 Reply Last reply
    0
    • G Offline
      G Offline
      goetz
      wrote on last edited by
      #2

      Your SQL query is wrong. I suggest reading the last paragraphs of http://www.sqlite.org/lang_select.html and use the following statement:

      @
      SELECT * FROM my_table LIMIT 20 OFFSET 20
      SELECT * FROM my_table LIMIT 20 OFFSET 40
      @

      http://www.catb.org/~esr/faqs/smart-questions.html

      1 Reply Last reply
      0
      • U Offline
        U Offline
        umen242
        wrote on last edited by
        #3

        Thanks very much for your answer !

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved