我正在使用;
SELECT * from posts order by id DESC limit 3
表结构为;
编号 |内容 |作者 |日期
问题是,它还会获取内容行中具有相同值的帖子。
结果
1- New cars in Oklahoma
2- New cars in Washington
3- New cars in Oklahoma
现在,假设一些帖子在内容行中具有完全相同的值,我怎样才能只获取这些帖子 1 次,以便它像这样获取
1- New cars in Oklahoma
2- New cars in Washington
最佳答案
假设您可以跳过一些行(因为它们是重复的):
SELECT * from posts group by `content` order by id DESC limit 3
这将显示包含相同内容的所有行。
关于php - mySQL - 如果帖子在特定行中具有相同的值,则不要多次获取帖子,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39819361/