MySQL 多表查詢分頁

不知為何就叫呵呵發表於2016-11-29
SELECT
    v.*, vt.id vid,
    vt.vote_id,
    vt. option,
    vt.poll
FROM
    vote v
JOIN vote_option vt ON v.id = vt.vote_id
WHERE
    v.id IN (
        SELECT
            t.id
        FROM
            (
                SELECT
                    id
                FROM
                    vote
                ORDER BY
                    id DESC
                LIMIT 0,
                2
            ) AS t
    )
ORDER BY
    id DESC

 

相關文章