如何在多行上执行datediff

时间:2022-03-13 22:21:46

I want to do something like this:

我想做这样的事情:

select datediff('2010-01-21',(select date_of_birth from people));

select datediff('2010-01-21',(从人们选择date_of_birth));

and take as result the difference from each date_of_birth.

并将每个date_of_birth的差异作为结果。

1 个解决方案

#1


You can use datediff to get Difference in terms of day or specified format (either month, week year, days etc)

您可以使用datediff来获取日期或指定格式(月,周,年等)的差异

select datediff(DAY,'2010-01-21',date_of_birth)
from people

#1


You can use datediff to get Difference in terms of day or specified format (either month, week year, days etc)

您可以使用datediff来获取日期或指定格式(月,周,年等)的差异

select datediff(DAY,'2010-01-21',date_of_birth)
from people