Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个 mysql 数据库,其中包含两个如下所示的表:
桌上游戏
id startTime(DateTime) 1 2012-10-30...
餐桌价格
gameID priceTime(DateTime) price(int) 1 2012-10-30 18:... 899 1 2012-10-28 15:... 699
我正在尝试加入表格并仅在 games.startTime 前 24 小时选择价格。这可能吗?
这将与游戏开始前 0-24 小时的价格相结合:
select * from games g join prices p on p.gameID = g.id and date_sub(g.startTime, interval 24 hour) <= p.priceTime and p.priceTime <= g.starttime