回答編集履歴
1
sample
answer
CHANGED
|
@@ -1,2 +1,11 @@
|
|
|
1
1
|
複数条件をlimitで処理しているならorder byしているはずですから
|
|
2
|
-
おなじorder byをかけてlimit 1でデータをとればよいのでは?
|
|
2
|
+
おなじorder byをかけてlimit 1でデータをとればよいのでは?
|
|
3
|
+
|
|
4
|
+
# sample
|
|
5
|
+
timestampで管理
|
|
6
|
+
```SQL
|
|
7
|
+
create table tbl(id int not null primary key,val int ,ts timestamp);
|
|
8
|
+
insert into tbl(id,val) values(1,100),(2,150),(3,300);
|
|
9
|
+
update tbl set val=400 where id=2;
|
|
10
|
+
select * from tbl order by ts desc limit 1;
|
|
11
|
+
```
|