[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: LIMIT first offset 0 or 1 ? and other LIMIT problems


Angel Behar wrote:
> 
> Hi, I'm running mysql 3.23.16-alpha-log w/o a problem, but now I'm confused
> about the LIMIT feature.  Must I use 0 as the first offset or use 1, the
> following query ruturns five rows that match the criteria :
> 
> mysql> SELECT codigo from muebles where cve_dpto='1' AND cve_clase = '10'
> AND cve_familia='02' AND agotado='D' LIMIT 1,10;
> +--------+
> | codigo |
> +--------+
> | 181129 |
> | 181145 |
> | 181161 |
> | 181201 |
> | 181463 |
> +--------+
> 5 rows in set (0.02 sec)
> 
> The exactly same query , but with offset 0 or without an offset returns 6
> rows :
> 
> mysql> SELECT codigo from muebles where cve_dpto='1' AND cve_clase = '10'
> AND cve_familia='02' AND agotado='D' LIMIT 0,10;
> +--------+
> | codigo |
> +--------+
> | 181031 |
> | 181129 |
> | 181145 |
> | 181161 |
> | 181201 |
> | 181463 |
> +--------+
> 6 rows in set (0.02 sec)
> 
> So, I have the same problem when only match 1, 2 or 3 rows and for example
> if I run another query wich matched 398 rows, the limit clause only works
> with the first 15 offsets, lets say :
> SELECT * from ropa where cve_depto='3' AND cve_clase ='03' AND
> cve_familia='001' GROUP BY codigo LIMIT 160,10 returns 0 rows.
> 
This means there were less than 160 matched rows without the limit.
Everything you have shown us is correct, as far as I can see.
Show us something that doesn't work, and document that it is not
working.
EX: SELECT count(*) from ropa where cve_depto='3' AND cve_clase ='03'
AND
cve_familia='001';

> If any one can give an advice, I'll appreciate.
> 
> Thanks in advance.
> 
> --
> ---------------------------------------------------------------------
> Please check "http://www.mysql.com/documentation/manual.php"; before
> posting. To request this thread, e-mail mysql-thread60396@xxxxxxxxxxxxxxx
> 
> To unsubscribe, send a message to:
>     <mysql-unsubscribe-gerald_clark=suppliersystems.com@xxxxxxxxxxxxxxx>
> 
> If you have a broken mail client that cannot send a message to
> the above address (Microsoft Outlook), you can use:
>     http://lists.mysql.com/php/unsubscribe.php

-- 
---------------------------------------------------------------------
Please check "http://www.mysql.com/documentation/manual.php"; before
posting. To request this thread, e-mail mysql-thread60400@xxxxxxxxxxxxxxx

To unsubscribe, send a message to:
    <mysql-unsubscribe-treed=ultraviolet.org@xxxxxxxxxxxxxxx>

If you have a broken mail client that cannot send a message to
the above address (Microsoft Outlook), you can use:
    http://lists.mysql.com/php/unsubscribe.php



This mailing list archive is a service of Copilot Consulting.