Okey,我需要按日期订购特定的ID。
假设我有:
ID 50 = 2015-01-22 14.00
ID 51 = 2015-01-23 14.00
我需要订购此商品,然后和WHERE一起下单? (我猜)
因此,如果我有$ _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的等级。