select DateDiff(n,欄位,GetDate()) AS DELAYTIME,* from 表格 where DateDiff(n,欄位,GetDate())>10 ORDER BY DELAYTIME
語法:
DATEDIFF ( datepart , startdate , enddate )
| datepart | 縮寫 |
|---|---|
| year | yy, yyyy |
| quarter | qq, q |
| month | mm, m |
| dayofyear | dy, y |
| day | dd, d |
| week | wk, ww |
| hour | hh |
| minute | mi, n |
| second | ss, s |
| millisecond | ms |
| microsecond | mcs |
| nanosecond | ns |
startdate
