简体   繁体   English

我想在 sql 中输出

[英]i want output in sql

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 

by this syntax:- datediff(day,fromdate,todate)通过这种语法:- datediff(day,fromdate,todate)

I want output in this way:- 0_days 1_days 2_days我希望以这种方式输出:- 0_days 1_days 2_days

1 1 3 1 1 3

use this query使用这个查询

select datediff(day, start_date, end_date) as days
from table1;

working exmaple here工作示例在这里

above query would give the total days between start_date and end_date上面的查询将给出 start_date 和 end_date 之间的总天数

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM