我有一个带有日期列的表,我用它来查询以从中获取一组行。
我不存储任何时间值只是日期和 T:00:00:00
我需要锻炼我有数据的未来几天和前几天。
我希望能够执行单个查询和日期以使用下一个和后退 UI 导航和查询来选择当前数据集
所以从这个开始获取最后一组数据
SELECT *
FROM `newco_bh_price_data`
WHERE `manager_id` =960
AND `currency_id` =0
AND `class_id` = 'A'
AND `price_date`
IN (SELECT MAX( `price_date` )
FROM `newco_bh_price_data`
)
我现在需要知道下一个日期是什么,以便查询
SELECT *
FROM `newco_bh_price_data`
WHERE `manager_id` =960
AND `currency_id` =0
AND `class_id` = 'A'
AND `price_date` = '2002-09-19'
感谢您的帮助和评论
这是数据示例
id price_date manager_id currency_id class_id value v_change
554 2002-09-19 960 0 A 8.631 0
553 2002-09-19 960 0 A 9.5635 0
552 2002-09-18 960 0 A 9.1068 0
551 2002-09-18 960 0 A 8.9351 0
550 2002-09-18 960 0 A 9.61 0
549 2002-09-17 960 0 A 9.1868 0
548 2002-09-17 960 0 A 9.0201 0
547 2002-09-17 960 0 A 9.6425 0
546 2002-09-16 960 0 A 9.3377 0
545 2002-09-16 960 0 A 9.3317 0
544 2002-09-16 960 0 A 9.6902 0
543 2002-09-13 960 0 A 9.418 0
542 2002-09-13 960 0 A 9.3669 0
541 2002-09-13 960 0 A 9.7125 0
540 2002-09-12 960 0 A 9.4463 0
539 2002-09-12 960 0 A 9.4383 0
538 2002-09-12 960 0 A 9.7474 0
537 2002-09-11 960 0 A 9.5303 0
536 2002-09-11 960 0 A 9.6592 0
535 2002-09-11 960 0 A 9.8041 0
534 2002-09-10 960 0 A 9.4666 0
533 2002-09-10 960 0 A 9.5878 0
532 2002-09-10 960 0 A 9.7651 0
531 2002-09-09 960 0 A 9.3104 0
530 2002-09-09 960 0 A 9.4841 0
529 2002-09-09 960 0 A 9.7498 0
528 2002-09-06 960 0 A 9.2462 0
527 2002-09-06 960 0 A 9.3823 0
526 2002-09-06 960 0 A 9.7501 0
525 2002-09-05 960 0 A 9.0465 0