w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
limit in mysql with 10K record taking too much time to execute(fail every time)

Hy all,

i found a solution that 100% working for me i can fetch larger data in few seconds

SELECT  
l.id,l.col1,l.col2,l.col3,l.col3,l.col4,l.col5,l.col6,l.col7
FROM    (
    SELECT  id
    FROM    mytable
   where removed='0'
    ORDER BY
            id
    LIMIT 10000
    ) o
JOIN    mytable
ON      l.id = o.id
ORDER BY
    l.id

This query is working cool





© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.