好的,我需要按日期订购特定的 ID。
假设我有:
ID 50 = 2015-01-22 14.00
ID 51 = 2015-01-23 14.00
我需要订购这个,然后在哪里买一个? (我猜)
所以如果我有 $_GET['51'] 我需要知道它在哪个地方。在本例中:数字 2
我还需要所有这些的列表,所以:
数字 1 = ID 50 = 2015-01-22 14.00
数字 2 = ID 51 = 2015-01-23 14.00
很基础,我想知道如何将日期更改为数字并按日期排序。
最佳答案
这是你想要的吗?
select count(*) as therank
from table t
where t.date <= (select t2.date from table t2 where t2.id = 51);
它根据日期返回 id = 51 的排名。
关于php - 按日期订购特定 ID - 只取出一个(队列系统),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28192034/