mysql에서 두 번째 마지막 데이터 행을 얻으려고 노력해 왔습니다. 하지만 내 쿼리는 마지막 행만 표시합니다.
SELECT news.news_title, news.news_details, news.news_author, news_images.filename
FROM news JOIN news_images
ON news.news_title = news_images.news_title
ORDER BY news_id DESC LIMIT 1
다음 OFFSET
과 같이 두 번째 마지막 값을 가져 오는 데 사용 합니다.
SELECT news.news_title, news.news_details, news.news_author, news_images.filename
FROM news JOIN news_images
ON news.news_title = news_images.news_title
ORDER BY news_id DESC
LIMIT 1 OFFSET 1;
LIMIT number_of_rows OFFSET start_from
2 개의 마지막 행을 원하면 다음을 사용하십시오 LIMIT 2
..
편집 : 귀하의 질문은 매우 명확하지 않지만 시도해보십시오.
SELECT t.news_title, t.news_details, t.news_author, ni.filename
FROM (SELECT news_title, news_details, news_author
FROM news
ORDER BY news_id DESC
LIMIT 1 OFFSET 1) AS t
JOIN news_images ni
ON t.news_title = ni.news_title
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다