具有多个表

时间:2016-10-20 23:30:14

标签: sql oracle join

我想像facebook一样在“Feed”中显示多篇文章。我拿到了这张桌子:

  • 链接(通过网页分享的链接){LINK_PAGE_ID,LINK_AUTHORS}
  • LINKS_SHARE(用户共享的链接){LINK_SHARE_AUTHORS_ID,LINK_SHARES_LINK_ID}
  • FOLLOWERS_PAGE(页面跟随者){FOLLOWERS_PAGE_PAGE_ID,FOLLOWERS_PAGE_AUTHORS_ID}
  • 追随者(用户追随者){AUTHORS_ID,FOLLOWER_ID}
  • 作者(用户简介){AUTHORS_ID}
  • 页面(页面简介){PAGE_ID}
  • 类别(文章类别)

我需要转换此查询:

SELECT * FROM (
  SELECT * 
    FROM LINKS 
   INNER JOIN FOLLOWERS_PAGE ON FOLLOWERS_PAGE_PAGE_ID = LINK_PAGE_ID 
   INNER JOIN PAGES ON PAGE_ID = FOLLOWERS_PAGE_PAGE_ID 
   INNER JOIN CATEGORIES ON CATEGORY_ID = PAGE_CATEGORIES 
    WHERE FOLLOWERS_PAGE_AUTHORS_ID = 1555 ORDER BY LINK_DATE DESC) 
WHERE ROWNUM <= 3

我怎么做?

0 个答案:

没有答案