TIP: Use Markdown or, <pre> for multi line code blocks / <code> for inline code.
These forums are read-only and for archival purposes only!
Please join our new forums at discourse.kohanaframework.org
Query Builder Limit issue
  • hello i'm tring to fetch large amount data from table using limit and offset, but there is a problem:
    there is my Query:

    DB::select('tblname.*', array(DB::expr('COUNT(`somefiled`)'), 'forwarded'))
            ->order_by('date', 'DESC')

    offset get by paging links, and limit is 10

    Query Builder turn my request to something like this: SELECT tblname.*, COUNT(somefiled) AS forwarded FROM cdr GROUP BY somefiled ORDER BY date DESC LIMIT 10 OFFSET 50
    i'm wondering why this query return proper result until my offset is under 55040 ( 5505 in numeric links in paging ), anyway problem was solved when i send query directly to MySQL in below structure:

    SELECT * FROM cdr LIMIT 55040 , 10

    the diffrence is using "offset" keyword, when i use offset keyword it not working ( for records above 55040 ).

    what is a problem ? how i can send my query like ... limit 50,10 instead using both limi and offset keyword in query builder ?

  • @ksharifi, did you try to send the offending query directly to MySQL?

    Also, it seems you can pass anything to limit. Try this and let us know:

    DB::select('tblname.*', array(DB::expr('COUNT(`somefiled`)'), 'forwarded'))
            ->order_by('date', 'DESC')
            ->limit($offset . ', ' . $limit)
  • The MySQL development project has made its source code available under the terms of the GNU General Public License, as well as under a variety of proprietary agreements.

    Maybe its limit for free version

  • @WinterSilence, MySQL has no limitations. Enterprise edition comes with support, additional software and a license that might better suit some commercial environments.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion