Im having difficulties creating a query. I have googled a lot but did not find a fitting solution. I have a table called blog (parent) and a table called entry (child):
<><> /strong>
- id
- subject
- owner
- id
- blog_id
- published (1 = published, 0 = unpublished)
- date_created (timestamp, when created and when published)
博客有多个条目。 其他用户只看到已公布的条目。
我想提出一个问题,它预示着最近10个经过修改的博客。 为此,可能需要在LQ中设置一个相应的平台,以搜寻所有博客,并由最新的PUBLISHED条目(入境日期:经修改)下令使用,但只有F进入。 公开发表
My SQL knowledge is not on a level which allows me to create such a query. Additional info: using PHP (codeigniter) with MySQL
我试图这样做,知道这样做永远不会奏效,但可以帮助你作为我试图完成的工作的参考。
SELECT blog.id
FROM blog
JOIN entry ON entry.blog_id = blog.id
WHERE entry.published = 1
ORDER by entry.date_created desc
LIMIT 0, 10
i want my end result to be the 10 blog.id s of which their child entry was published most recenlty. Can someone please help? All help is greatly appreciated.
如果在1个询问中无法做到这一点,也许有PHP,i可以做每个陈述,回答个人询问?