在不使用子查询的情况下,可以使用JOIN子句和GROUP BY子句来选择所有只有空帖子的作者的author_id。
假设有两个表,一个是作者表(authors),包含author_id和author_name字段;另一个是帖子表(posts),包含post_id和author_id字段。我们需要选择所有只有空帖子的作者的author_id。
可以按照以下步骤来解决:
下面是一个示例代码:
SELECT authors.author_id
FROM authors
LEFT JOIN posts ON authors.author_id = posts.author_id
GROUP BY authors.author_id
HAVING COUNT(posts.post_id) = 0;
这将选择并显示只有空帖子的作者的author_id。
下一篇:不使用字典动态创建变量”的