我有书和收件人表。我想按收件人表的成员资格日期列选择最多 20 行的顺序。拿到后,我想按书台的 id 列订购。我写了那个sql。有没有办法用更少的代码做到这一点?
SELECT *
FROM ( SELECT *
FROM ( SELECT b.*
FROM book b
JOIN recipient r ON r.id = b.recipient_id
WHERE b.bookno = 115
ORDER BY r.membershipdate DESC
)
WHERE ROWNUM <= 20
)
ORDER BY ID DESC