mysql分页

SELECT 
        _t.id
        FROM 
        (
            SELECT 
            l.id AS id
            FROM 
            t_gnzl_log l 
            WHERE 1=1
            AND l.`plat` = 1
            AND l.`shop` = 1
            AND l.`agencyCode` = ''
            ORDER BY l.`createTime` DESC
        ) AS _t 
        JOIN (
            SELECT 
            _l.id AS id
            FROM 
            t_gnzl_log _l
            WHERE 1=1
            AND _l.`plat` = 1
            AND _l.`shop` = 1
            AND _l.`agencyCode` = ''
            ORDER BY _l.`createTime` DESC
            LIMIT 0,2
        ) t 
        ON 
        _t.id = t.id

 

你可能感兴趣的:(mysql分页)