轨道与条件不同
我有四个数据表,这些表重复了状态,但具有不同的创建_at(假设它是在一个名为“测试”的相关模型上)
样本:
column 1: status_type : "test", created_at: "2019-08-14"
column 2: status_type : "test", created_at: "2020-20-14"
column 3: status_type : "integer", created_at: "2021-20-15"
column 4: status_type : "integer", created_at: "2022-22"15"
我想获得两个数据,这是测试和整数,但我需要一个是最新更新的数据或谁是根据他们的创建_at的最新消息。如何查询这个?谢谢
I have four table in data which have repeated status but with different created_at (assuming it is on an associated model named "test")
Sample:
column 1: status_type : "test", created_at: "2019-08-14"
column 2: status_type : "test", created_at: "2020-20-14"
column 3: status_type : "integer", created_at: "2021-20-15"
column 4: status_type : "integer", created_at: "2022-22"15"
I want to get two data which is test and integer but i need the one who is the most updated or who is more recent based on their created_at. How to query this? Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你可以做以下
You can do the following