SQL INTERVAL()函數
INTERVAL(N,N1,N2,N3,..........)
INTERVAL()函數將N個列表(N1,N2,N3,等等)的值進行比較。該函數返回0如果N<N1,1如果N<N2,2如果N<N 3,依此類推。它會返回1,如果N為NULL。值列表必須是N1<N2<N3形式才能正常工作。下麵的代碼是演示INTERVAL()函數的工作原理,一個簡單的例子:
SQL>SELECT INTERVAL(6,1,2,3,4,5,6,7,8,9,10); +---------------------------------------------------------+ | INTERVAL(6,1,2,3,4,5,6,7,8,9,10) | +---------------------------------------------------------+ | 6 | +---------------------------------------------------------+ 1 row in set (0.00 sec)