这样的表格:
-----------------------------
id pid key value
-----------------------------
1 3 all 120
2 3 today 180
3 9 all 200
4 9 today 150
5 9 others 0
-----------------------------
如何
select * from table if all(120) < today(180) and if they have same pid(3)
我希望结果应该是:
---------------------------
id pid key value
---------------------------
1 3 all 120
2 3 today 180
最佳答案
假设您想要相同 pid 存在另一个具有所有 < 今天的条目的所有条目
select t from table t where exists(
select * from table t2 where t.all < t2.today and t.pid = t2.pid
)
关于Mysql SELECT 值比较?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38337523/