fromdate todate
1/5/2017 1/7/2017
1/5/2017 1/5/2017
1/5/2017 1/7/2017
1/5/2017 1/7/2017
1/5/2017 1/6/2017
通过以下语法: - datediff(day,fromdate,todate)
我想以这种方式输出: - 0_days 1_days 2_days
1 1 3
答案 0 :(得分:0)
使用此查询
select datediff(day, start_date, end_date) as days
from table1;
工作exmaple here
上面的查询将给出start_date和end_date之间的总天数