SQL筛选日期为周末 - datename( )

对于SQL表里日期列筛选,只保留周末的数据可以用SQL中的datename()函数。例:

select id, Name, Date
from table_a
where datename(weekday, Date) in ('Saturday', 'Sunday');

同理可以用只工作日/只周一等其他筛选条件。

猜你喜欢

转载自blog.csdn.net/m0_59773145/article/details/119257771