出于成本考虑,我需要在最近的匹配日期加入。问题是我只想匹配最近的日期。例如今天
2019-05-03
将匹配我的costs_internal表中的所有内容:
select s.part, s.location, s.qty, s.complete, s.job_no,
ci.amount as minute_cost
from stock as s join part_timings as pt on pt.part = s.part
join costs_internal as ci on s.date >= ci.date
where s.qty > 0 group by s.part, s.location, s.job_no order by s.part
我正在使用sqlite版本3.16(使用Python)